1
public partial class WebForm1 : System.Web.UI.Page
{
protected override void OnInit(EventArgs e)
{
var t = new TemplatedWizardStep { Title = "Lalalal" };
t.Controls.Add(new Step1UserControl());
_WizardWebControl.WizardSteps.Add(t);
base.OnInit(e);
}
}
頁標記:
<asp:Wizard runat="server" id="_WizardWebControl">
Step1UserControl.ascx標記:
<fieldset>
<legend>General Informations</legend>
<p>TEST DYNAMIC</p>
</fieldset>
步驟顯示在與標題左邊欄,但HTML(字段和段落)不顯示在步驟中。它也需要成爲TemplatedWizardStep,因爲我們使用Template來佈局。如何動態添加步驟?
@abatishchev:請不要將類名更改爲var,如果是粗言穢語,則不要使用變量名 – ika 2010-10-23 10:33:25