当向导属性DisplaySideBar
为False
时,此代码具有向导步骤标题,但不起作用,标签lbl
将为null
:
protected void Wizard1_ActiveStepChanged(object sender, EventArgs e)
{
// Grab a reference to the label control
Label lbl = (Label)Wizard1.FindControl("lblStepTitle");
lbl.Text = Wizard1.ActiveStep.Title;
}
HTML(省略了向导步骤):
<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0" DisplaySideBar="False"
OnActiveStepChanged="Wizard1_ActiveStepChanged"
OnNextButtonClick="Wizard1_NextButtonClick"
OnFinishButtonClick="Wizard1_FinishButtonClick">
<HeaderStyle HorizontalAlign="Center" Font-Bold="True" />
<HeaderTemplate>
Edit User Wizard
<br />
<br />
<asp:Label ID="lblStepTitle" runat="server" Text="Step Title"></asp:Label>
</HeaderTemplate>
</asp:Wizard>
答案 0 :(得分:0)