<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
if (PeterBlum.DES.Globals.WebFormDirector.IsValid)
{
}
}
</script>
<h2>ListBox</h2>
Must not select '4'.<br/><br/>
<asp:ListBox ID="ListBox1" runat="server">
<asp:ListItem Selected="True">1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:ListBox>
<des:SelectedIndexValidator ID="SelectedIndexValidator1" runat="server"
ControlIDToEvaluate="ListBox1"
ErrorMessage="Don't select '4'"
Index="3" Selected="false">
</des:SelectedIndexValidator>
<br/>
<br/>
<h2>Multiple selection ListBox</h2>
Must include '3' amongst your selections.<br/><br/>
<asp:ListBox ID="ListBox2" runat="server" SelectionMode="Multiple">
<asp:ListItem Selected="True">1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:ListBox>
<des:SelectedIndexValidator ID="SelectedIndexValidator2" runat="server"
ControlIDToEvaluate="ListBox2"
ErrorMessage="Must select '3' amongst your other selections"
Index="2" Selected="true">
</des:SelectedIndexValidator>
<br/>
<br/>
<h2>RadioButtonList</h2>
Don't select '3'<br/><br/>
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem Selected="True">1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:RadioButtonList>
<des:SelectedIndexValidator ID="SelectedIndexValidator3" runat="server"
ControlIDToEvaluate="RadioButtonList1"
ErrorMessage="Don't select '3'"
Index="2" Selected="false">
</des:SelectedIndexValidator>
<br/>
<br/>
<h2>CheckBoxList</h2>
Don't select '3'<br/><br/>
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:CheckBoxList>
<des:SelectedIndexValidator ID="SelectedIndexValidator4" runat="server"
ControlIDToEvaluate="CheckBoxList1"
ErrorMessage="Don't select '3'"
Index="2" Selected="false">
</des:SelectedIndexValidator>
<br/><br/>
<des:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click"></des:Button>