<html>
<head>
<title>MultiView ActiveViewIndex Example</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server">
protected void moveNext ( object src, EventArgs e ) {
// determine which button was clicked and
if ( devPoll.ActiveViewIndex > -1 && devPoll.ActiveViewIndex < 3 ) {
// increment the ActiveViewIndex property by one to advance to the next view
devPoll.ActiveViewIndex ++;
}
else if ( devPoll.ActiveViewIndex == 3 ) {
// this is the final view. insert code here to save survey results
// then disable the navigation buttons
Page4Save.Enabled = false;
Page4Restart.Enabled = false;
}
else {
throw new Exception ( "An error occurred." );
}
}
protected void moveBack ( object src, EventArgs e ) {
if ( devPoll.ActiveViewIndex > 0 & devPoll.ActiveViewIndex <= 2 ) {
// decrement the ActiveViewIndex property by one to return to the previous view
devPoll.ActiveViewIndex --;
}
else if ( devPoll.ActiveViewIndex == 3 ) {
// this is the final view. return to the first view.
devPoll.ActiveViewIndex = 0;
}
else {
throw new Exception ( "An error occurred." );
}
}
</script>
</head>
<body>
<!-- #include virtual="~/shared/top.inc -->
<div class="header"><h2>MultiView ActiveViewIndex Example</h2></div>
<!-- #include virtual="~/shared/viewsrc_top.inc" -->
<hr size=1 width=92%>
<div align="center">
<form runat="server">
<asp:panel id="Page1ViewPanel"
width=50% horizontalalign="center"
backcolor="lightsteelblue"
style="padding: 10; border: 1px inset"
runat="Server">
<asp:multiview id="devPoll"
activeviewindex=0
runat="Server">
<asp:view id="Page1" runat="Server">
<p><asp:label id="Page1Label"
font-bold="true"
text="What kind of applications do you develop?"
runat="Server" /></p>
<asp:radiobutton id="Page1Radio1"
text="Web Applications"
checked=false
groupname="RadioGroup1"
runat="server" />
<asp:radiobutton id="Page1Radio2"
text="Windows Forms Applications"
checked=false
groupname="RadioGroup1"
runat="server" />
<p><asp:button id="Page1Next"
text="Next"
OnClick="moveNext"
height="25"
width="70"
runat="Server" /></p>
</asp:view>
<asp:view id="Page2" runat="Server">
<p><asp:label id="Page2Label"
font-bold="true"
text="How long have you been a developer?"
runat="Server" /></p>
<asp:radiobutton id="Page2Radio1"
text="Less than five years"
checked=false
groupname="RadioGroup1"
runat="Server" />
<asp:radiobutton id="Page2Radio2"
text="More than five years"
checked=false
groupname="RadioGroup1"
runat="Server" />
<p><asp:button id="Page2Back"
text="Previous"
OnClick="moveBack"
height="25"
width="70"
runat="Server" />
<asp:button id="Page2Next"
text="Next"
OnClick="moveNext"
height="25"
width="70"
runat="Server" /></p>
</asp:view>
<asp:view id="Page3" runat="Server">
<p><asp:label id="Page3Label1"
font-bold="true"
text="What is your primary programming language?"
runat="Server" /></p>
<asp:radiobutton id="Page3Radio2"
text="C#"
checked=false
groupname="RadioGroup1"
runat="Server" />
<asp:radiobutton id="Page3Radio1"
text="VB .NET"
checked=false
groupname="RadioGroup1"
runat="Server" />
<asp:radiobutton id="Page3Radio3"
text="C++"
checked=false
groupname="RadioGroup1"
runat="Server" />
<p><asp:button id="Page3Back"
text="Previous"
OnClick="moveBack"
height="25"
width="70"
runat="Server" />
<asp:button id="Page3Next"
text="Next"
OnClick="moveNext"
height="25"
width="70"
runat="Server" /></p>
</asp:view>
<asp:view id="Page4" runat="Server">
<p><asp:label id="Label1"
font-bold="true"
text="Thank you for taking the survey."
runat="Server" /></p>
<p><asp:button id="Page4Save"
text="Save Responses"
OnClick="moveNext"
height="25"
width="110"
runat="Server" />
<asp:button id="Page4Restart"
text="Retake Survey"
OnClick="moveBack"
height="25"
width="110"
runat="Server" /></p>
</asp:view>
</asp:multiview>
</asp:panel>
</form>
</div>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>