G
Guest
I'm trying to put conditional code in a dropdown that would check the value
of the current ListItem and set Selected=true depending on that value, and
Selected=false if it's any other value.
Due to security restrictions, I can't place any script blocks on, or behind,
the page, so it has to be done in the .Net framework.
I've tried using the CompareValidator but that throws errors. (see code
block below)
Any ideas?
<asp
ropDownList runat="server" id="ctl_03" DataTextField="StateName"
DataSourceID="StateList" DataValueField="StateName" DataMember="DefaultView"
AutoPostBack="True" AppendDataBoundItems="true">
<asp:CompareValidator runat="server" ErrorMessage="CustomValidator"
id="CompareValidator 1" ControlToValidate="ctl_03"
ValueToCompare="California" type="String" Operator="Equal" >
<asp:ListItem Selected="True" Value="California" Text="California" />
</asp:CompareValidator >
<asp:ListItem Value="" Text="" />
</asp
ropDownList>
of the current ListItem and set Selected=true depending on that value, and
Selected=false if it's any other value.
Due to security restrictions, I can't place any script blocks on, or behind,
the page, so it has to be done in the .Net framework.
I've tried using the CompareValidator but that throws errors. (see code
block below)
Any ideas?
<asp
DataSourceID="StateList" DataValueField="StateName" DataMember="DefaultView"
AutoPostBack="True" AppendDataBoundItems="true">
<asp:CompareValidator runat="server" ErrorMessage="CustomValidator"
id="CompareValidator 1" ControlToValidate="ctl_03"
ValueToCompare="California" type="String" Operator="Equal" >
<asp:ListItem Selected="True" Value="California" Text="California" />
</asp:CompareValidator >
<asp:ListItem Value="" Text="" />
</asp