Tuesday, May 28, 2013

Required Field Validation for Ajax Combobox

Required field validation not working with Ajax combobox

Reason:-

Combobox doesn't rendered as a dropdownlist. Infact,it is interpreted as a textbox.So,required field validation with initial value attritube="(selected value)" will not work.It required to set initial 
value = "--Select--"  in order for combobox satisfied your required field validation.

<asp:ComboBox ID="ComboEMINo" runat="server"  AutoPostBack="true" >
</asp:ComboBox>
 <asp:RequiredFieldValidator ID="rfvEMINo" ControlToValidate="ComboEMINo" runat="server"
 ErrorMessage="Select EMINo." ForeColor="Red" InitialValue="--Select--">*</asp:RequiredFieldValidator>


1 comment: