Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using rad combo box control on my page and i bind this by using wizard given in it ...
i trying to validate this using required field validator , but it not working ...
i tried also by setting initieal value =0 or text value of this index



but nothing is working ...
any suggestion .. plss bros... ?



XML
<telerik:RadComboBox ID="CountryCombo" runat="server" CssClass="MyComboBox" DataSourceID="SqlDataSource1" DataTextField="Country_Name" DataValueField="CountryID" EmptyMessage="Select Country"></telerik:RadComboBox>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=FTPL01\SQL2012;Initial Catalog=ZricksDB;Persist Security Info=True;User ID=sa;Password=webuser" ProviderName="System.Data.SqlClient" SelectCommand="SELECT [CountryID], [Country_Name] FROM [Country_Master]"></asp:SqlDataSource>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="CountryCombo" InitialValue="0" ErrorMessage="*"></asp:RequiredFieldValidator>

Posted
Updated 27-May-19 20:45pm
Comments
Aravindba 14-Mar-14 6:40am    
Hai what u need to validate ? if combobox item not select ?

1 solution

Do not add InitialValue. Remove that it will work correctly.
Below i have added code you can try-

<telerik:radcombobox id="CountryCombo" runat="server" cssclass="MyComboBox" datasourceid="SqlDataSource1" datatextfield="Country_Name" datavaluefield="CountryID" emptymessage="Select Country"></telerik:radcombobox>

    <asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="Data Source=FTPL01\SQL2012;Initial Catalog=ZricksDB;Persist Security Info=True;User ID=sa;Password=webuser" providername="System.Data.SqlClient" selectcommand="SELECT [CountryID], [Country_Name] FROM [Country_Master]"></asp:sqldatasource>

    <asp:requiredfieldvalidator id="RequiredFieldValidator6" runat="server" controltovalidate="CountryCombo" errormessage="*"></asp:requiredfieldvalidator>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900