I have a RadComboBox that has its EmptyMessage property set to - Select Table -. I am trying to create a some validation where if the user does not select a Table from the RadComboBox an error message is displayed saying "Please select a table..."
//RadComboBox:
<telerik:RadComboBox ID="RadComboBoxTables" Runat="server"
DataSourceID="ObjectDataSourceMetaDateTables" DataTextField="Name"
DataValueField="Name" Label="Table: "
ondatabound="Tables_DataBound"
onitemsrequested="Tables_ItemsRequested"
OnClientSelectedIndexChanging="metaDataTableSelected"
LabelCssClass="riLabel" Width="100%"
EmptyMessage="- Select table - "
ValidationGroup="AttrValidationGroup">
</telerik:RadComboBox>
I tried doing this 2 ways:
1. I used a CompareValidator..This should display the error message if the user does not select a table; however, no error message is displayed. If select -Select table - from RadComboBox again, no error is displayed. Is/Can the EmptyMessage be used here as the value to compare to?
(NOTE: if I change the Operator to Operator=Equal, then it displays the error if user doesn't select anything, selects a table, or selects "- Select table - " from RadComboBox.)
//CompareValidator:
<asp:CompareValidator
ID="CompareValidatorRadComboxBoxTables"
runat="server"
ValueToCompare=" - Select table - "
Operator="NotEqual"
ControlToValidate="RadComboBoxTables"
ErrorMessage="Please select Table..."
ValidationGroup="AttrValidationGroup">
</asp:CompareValidator>
I also tried using the Requiredfield Validator like a saw in an example on this site (http://demos.telerik.com/aspnet-ajax/combobox/examples/default/defaultcs.aspx this example worked fine), but no error was displayed for my app.
//RequiredFieldValidator:
<asp:RequiredFieldValidator ID="RequiredFieldValidatorComboTxtBxTables"
runat="server"
ControlToValidate="RadComboBoxTables"
ErrorMessage="Please select table from list..."
ValidationGroup="AttrValidationGroup">
</asp:RequiredFieldValidator>
Any advice and/or help will be appreciated.
Thanks in advance...
gary