<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
if (PeterBlum.DES.Globals.WebFormDirector.IsValid)
{
}
}
</script>
<h2>ListBox</h2>
This example applies equally well to a DropDownList and RadioButtonList too.<br/>
Unless your setup for "no selection" actually has no selected item, set the <span class="PropertyName">UnassignedIndex</span> property
to 0 or the index of the ListItem that indicates "no selection".<br/><br/>
<asp:ListBox ID="ListBox1" runat="server" >
<asp:ListItem Selected="True">Not assigned</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:ListBox>
<des:RequiredListValidator ID="RequiredListValidator1" runat="server"
ControlIDToEvaluate="ListBox1"
ErrorMessage="required" UnassignedIndex="0" >
</des:RequiredListValidator>
<br/><br/>
<des:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click"></des:Button>