如何访问Wizard控件里的按钮

本文介绍 ASP.NET 中 Wizard 控件的基本用法,通过一个简单示例展示了如何定义步骤及在各步骤间导航的方法。具体包括如何创建 Wizard 控件、设置步骤标题以及在每个步骤激活时获取相应的导航按钮。
一个简单的例子。
aspx:
<asp:wizard id="Wizard1" runat="server">
    
<wizardsteps>
        
<asp:wizardstep id="step1" runat="server" onactivate="step1_Activate" title="Step 1">
            Step 1
        
</asp:wizardstep>
        
<asp:wizardstep id="step2" runat="server" onactivate="step2_Activate" title="Step 2">
            Step 2
        
</asp:wizardstep>
        
<asp:wizardstep id="step3" runat="server" onactivate="step3_Activate" title="Step3">
            Step 3
        
</asp:wizardstep>
    
</wizardsteps>
</asp:wizard>

CODE-BEHIND:
protected void Page_Load(object sender, EventArgs e)
{
    
if (!this.IsPostBack)
    
{
        
this.step1_Activate(step1, EventArgs.Empty);
    }

}


protected void step1_Activate(object sender, EventArgs e)
{
    Button next 
= Wizard1.FindControl("StartNavigationTemplateContainerID").FindControl("StartNextButton"as Button;
}


protected void step2_Activate(object sender, EventArgs e)
{
    Button previous 
= Wizard1.FindControl("StepNavigationTemplateContainerID").FindControl("StepPreviousButton"as Button;
    Button next 
= Wizard1.FindControl("StepNavigationTemplateContainerID").FindControl("StepNextButton"as Button;
}


protected void step3_Activate(object sender, EventArgs e)
{
    Button previous 
= Wizard1.FindControl("FinishNavigationTemplateContainerID").FindControl("FinishPreviousButton"as Button;
    Button finish 
= Wizard1.FindControl("FinishNavigationTemplateContainerID").FindControl("FinishButton"as Button;
}

转载于:https://www.cnblogs.com/straw808/archive/2007/10/10/919831.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值