我正在使用 MultiView 构建多步骤表单。下一步按钮适用于第一步 (ViewOne),但下一步和后退按钮在下一步 (ViewTwo) 中均不执行任何操作。
不知道下面的代码有什么线索还是需要看更多?...
<asp:MultiView ID="MultiView2" runat="server" ActiveViewIndex="0">
<asp:View ID="ViewOne" runat="server">
</asp:View>
<asp:View ID="ViewTwo" runat="server">
</asp:View>
</asp:MultiView>
<asp:ImageButton ID="btnBack" runat="server" ImageUrl="/assets/back_button.jpg" OnClick="btnBack_Click" />
<asp:ImageButton ID="btnNext" runat="server" ImageUrl="/assets/next_button.gif" OnClick="btnNext_Click" />
<asp:ImageButton ID="btnSubmit" runat="server" ImageUrl="/assets/submit_button.gif" OnClick="btnSend_Click" />
后面的代码......
protected void btnBack_Click(object sender, EventArgs e)
{
MultiView2.ActiveViewIndex--;
}
protected void btnNext_Click(object sender, EventArgs e)
{
MultiView2.ActiveViewIndex++;
}
protected void btnSend_Click(object sender, EventArgs e)
{
OnSubmitClicked(e);
}
好的,更多代码...
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
PopulateSomeField();
}
protected override void OnPreRender(EventArgs e)
{
btnBack.Visible = MultiView2.ActiveViewIndex > 0;
btnNext.Visible = MultiView2.ActiveViewIndex < MultiView2.Views.Count - 1;
btnSubmit.Visible = MultiView2.ActiveViewIndex == MultiView2.Views.Count - 1;
base.OnPreRender(e);
}