如何删除radwizard步骤

时间:2019-02-20 06:12:46

标签: c# asp.net telerik

很抱歉,这是一个非常基本的问题,我是编程新手。我已经创建了rad向导步骤,可以动态地单击按钮。现在我要删除或删除步骤。有人可以告诉我我该怎么做。

谢谢。

MarkUP:                                                                                                                                             

    </telerik:RadAjaxManager>
    <div>
        <table width="100%">
            <tr>
                <td>
                    <telerik:RadButton runat="server" RenderMode="Lightweight" ID="rbtnLoadWizard" Text="Add WizardSteps" OnClick="rbtnLoadWizard_Click"></telerik:RadButton>

                    <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>
                    <telerik:RadButton runat="server" RenderMode="Lightweight" ID="rbtnRemoveWizard" Text="Remove Wizard" OnClick="rbtnRemoveWizard_Click"></telerik:RadButton>
                </td>
            </tr>
        </table>
    </div>

后面的代码:

 public void createSteps()
    {
        Table dynamicTable;
        RadWizardStep step;
        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();

            TableRow tRow = new TableRow();
            TableCell tCell = new TableCell();
            RadTextBox rtb = new RadTextBox();
            tCell.Controls.Add(rtb);
            tRow.Cells.Add(tCell);
            dynamicTable.Controls.Add(tRow);
            step.Controls.Add(dynamicTable);
            UiWizard.WizardSteps.Add(step);
        }
    }

    protected void rbtnLoadWizard_Click(object sender, EventArgs e)
    {
        createSteps();
    }

1 个答案:

答案 0 :(得分:0)

我找到了解决方法

  int count = UIControlsWizard.WizardSteps.Count;
  for (int i = 0; i < count; i++)
  {
     UIControlsWizard.WizardSteps.RemoveAt(0);
  }