MultiView ActiveViewIndex Example
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<script runat="server">
Sub NextButton_Command(sender As Object, e As System.EventArgs)
If (DevPollMultiView.ActiveViewIndex > -1) AND DevPollMultiView.ActiveViewIndex < 3 Then
DevPollMultiView.ActiveViewIndex += 1
ElseIf DevPollMultiView.ActiveViewIndex = 3 Then
Page4Save.Enabled = False
Page4Restart.Enabled = False
Else
Throw New Exception("An error occurred.")
End If
End Sub
Sub BackButton_Command(ByVal sender As Object, ByVal e As System.EventArgs)
If (DevPollMultiView.ActiveViewIndex > 0) And DevPollMultiView.ActiveViewIndex <= 2 Then
DevPollMultiView.ActiveViewIndex -= 1
ElseIf DevPollMultiView.ActiveViewIndex = 3 Then
DevPollMultiView.ActiveViewIndex = 0
Else
Throw New Exception("An error occurred.")
End If
End Sub
</script>
</head>
<body>
<form ID="Form1" runat="Server">
<h3>MultiView ActiveViewIndex Example</h3>
<asp:Panel id="Page1ViewPanel"
Width="330px"
Height="150px"
HorizontalAlign =Left
Font-size="12"
BackColor="#C0C0FF"
BorderColor="#404040"
BorderStyle="Double"
runat="Server">
<asp:MultiView id="DevPollMultiView"
ActiveViewIndex=0
runat="Server">
<asp:View id="Page1"
runat="Server">
<asp:Label id="Page1Label"
Font-bold="true"
Text="What kind of applications do you develop?"
runat="Server">
</asp:Label><br><br>
<asp:RadioButton id="Page1Radio1"
Text="Web Applications"
Checked="False"
GroupName="RadioGroup1"
runat="server" >
</asp:RadioButton><br>
<asp:RadioButton id="Page1Radio2"
Text="Windows Forms Applications"
Checked="False"
GroupName="RadioGroup1"
runat="server" >
</asp:RadioButton><br><br><br>
<asp:Button id="Page1Next"
Text = "Next"
OnClick="NextButton_Command"
Height="25"
Width="70"
runat= "Server">
</asp:Button>
</asp:View>
<asp:View id="Page2"
runat="Server">
<asp:Label id="Page2Label"
Font-bold="true"
Text="How long have you been a developer?"
runat="Server">
</asp:Label><br><br>
<asp:RadioButton id="Page2Radio1"
Text="Less than five years"
Checked="False"
GroupName="RadioGroup1"
runat="Server">
</asp:RadioButton><br>
<asp:RadioButton id="Page2Radio2"
Text="More than five years"
Checked="False"
GroupName="RadioGroup1"
runat="Server">
</asp:RadioButton><br><br><br>
<asp:Button id="Page2Back"
Text = "Previous"
OnClick="BackButton_Command"
Height="25"
Width="70"
runat= "Server">
</asp:Button>
<asp:Button id="Page2Next"
Text = "Next"
OnClick="NextButton_Command"
Height="25"
Width="70"
runat="Server">
</asp:Button>
</asp:View>
<asp:View id="Page3"
runat="Server">
<asp:Label id="Page3Label1"
Font-bold="true"
Text= "What is your primary programming language?"
runat="Server">
</asp:Label><br><br>
<asp:RadioButton id="Page3Radio1"
Text="Visual Basic .NET"
Checked="False"
GroupName="RadioGroup1"
runat="Server">
</asp:RadioButton><br>
<asp:RadioButton id="Page3Radio2"
Text="C#"
Checked="False"
GroupName="RadioGroup1"
runat="Server">
</asp:RadioButton><br>
<asp:RadioButton id="Page3Radio3"
Text="C++"
Checked="False"
GroupName="RadioGroup1"
runat="Server">
</asp:RadioButton><br><br>
<asp:Button id="Page3Back"
Text = "Previous"
OnClick="BackButton_Command"
Height="25"
Width="70"
runat="Server">
</asp:Button>
<asp:Button id="Page3Next"
Text = "Next"
OnClick="NextButton_Command"
Height="25"
Width="70"
runat="Server">
</asp:Button><br>
</asp:View>
<asp:View id="Page4"
runat="Server">
<asp:Label id="Label1"
Font-bold="true"
Text = "Thank you for taking the survey."
runat="Server">
</asp:Label>
<br><br><br><br><br><br>
<asp:Button id="Page4Save"
Text = "Save Responses"
OnClick="NextButton_Command"
Height="25"
Width="110"
runat="Server">
</asp:Button>
<asp:Button id="Page4Restart"
Text = "Retake Survey"
OnClick="BackButton_Command"
Height="25"
Width="110"
runat= "Server">
</asp:Button>
</asp:View>
</asp:MultiView>
</asp:Panel>
<asp:MultiView ID="MultiView1" runat="server">
</asp:MultiView>
</form>
</body>
</html>
Related examples in the same category