Я создал шаги Radwizard динамически, каждый шаг содержит динамическую таблицу, и я добавляю элемент управления в таблицу нажатием кнопки.Теперь я хочу выделить элемент управления и удалить его по нажатию кнопки удаления.
Спасибо.
Разметка :
<table>
<tr>
<td>
<telerik:RadWizard runat="server" RenderMode="Lightweight" ID="UiWizard" ClientIDMode="Static" Width="100%" ProgressBarPosition="Right" Localization-Next="Save and Continue" DisplayNavigationButtons="true" NavigationBarPosition="Right" NavigationButtonsPosition="Bottom" DisplayProgressBar="false">
</telerik:RadWizard>
</td>
</tr>
<tr>
<td>
<asp:Button runat="server" Text="AddControl" OnClientClick="SelectedControl(); return false" />
<asp:Button runat="server" Text="RemoveControl" />
</td>
</tr>
</table>
Скрипт:
function createControls() {
return '<input type="text" />';
}
var control = null;
function SelectedControl(sender) {
var wizard = $find("<%= UiWizard.ClientID%>");
var activeIndex = wizard.get_activeIndex();
var tblUIControls = document.getElementById('ControlTable_' + activeIndex);
control = createControls();
}
Код позади :
RadWizardStep step;
Table dynamicTable;
protected void Page_Load(object sender, EventArgs e)
{
createSteps();
}
public void createSteps()
{
for (int i = 0; i < 3; i++)
{
step = new RadWizardStep();
step.ID = "step_" + i.ToString();
step.ClientIDMode = ClientIDMode.Static;
dynamicTable = new Table();
dynamicTable.ClientIDMode = ClientIDMode.Static;
dynamicTable.ID = "ControlTable_" + i.ToString();
step.Controls.Add(dynamicTable);
UiWizard.WizardSteps.Add(step);
}
}