I have a ig:WebDropDown which is having the starting value as 'Select' as below
I used RequiredFieldValidator for the control as below,
<
asp:RequiredFieldValidator ID="rfvEmployee" runat="server" InitialValue="Select"
The problem is when i have value as 'Select' in WebDropDown and click on some button,
the validation fired correctly and after selecting some other value other than 'Select' in WebDropDown
and the Validation Message is not going off, still its showing as 'Select a Team'
What i came to know is only when some post back is happening then only the Validation is working
fine, becoz when i set AutoPostBack = true for WebDropDown its working.
But i dont want to set AutoPostBack = true.
So, can you provide a solution for this ASAP, how to use RequiredFieldValidator for ig:WebDropDown without using
AutoPostBack to true.
---------------------------
Thanks in Advance.
Pavan.
You don't need to set AutoPostBack to true. the asp:RequiredFieldValidatior works fine without a postback, please have a look at the attached sample.
Check out the following code:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<ig:WebDropDown ID="WebDropDown1" runat="server" Width="200px" EnableAutoFiltering="Off" DisplayMode="DropDownList">
<Items>
<ig:DropDownItem Selected="False" Text="Select" Value="">
</ig:DropDownItem>
<ig:DropDownItem Selected="False" Text="DropDown Item" Value="">
</Items>
</ig:WebDropDown>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1" ControlToValidate="WebDropDown1" InitialValue="Select" ErrorMessage="Please select something "></asp:RequiredFieldValidator>
<asp:Button runat="server" Text="Submit the Form" />
</div>
</form>
Hope this helps,
Angel