This is a migrated thread and some comments may be shown as answers.

ClientValidationFunction being called on SelectedIndexChanged?

1 Answer 160 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Craig Wallace
Top achievements
Rank 1
Craig Wallace asked on 05 Oct 2010, 08:44 AM
Hi,

I just discovered that RadComboBox sends the Text and not the Value to the RequiredFieldValidator.  This means I had to write a custom validator for RadComboBox.  This is fine for server-side but for the ClientValidationFunction I have a problem.  I have it working, but the ClientValidationFunction is also called when the RadComboBox OnClientSelectedIndexChanging event is fired.  This causes it to be validated before the selected index is set and so produce an incorrect validation result.

How can I prevent the OnClientSelectedIndexChanging event from causing the ClientValidationFunction to fire?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Oct 2010, 11:00 AM
Hello,


I guess setting the ValidationGroup will dio the trick. Check the sample code.

Mark-up:
<telerik:RadComboBox EnableTheming="false" AutoPostBack="true" >
    <Items>
      . . .
    </Items>
</telerik:RadComboBox>
<asp:CustomValidator ID="Validator1" runat="server" ValidationGroup="vg" ClientValidationFunction="ClientValidationFunction"
    ErrorMessage="CustomValidator"></asp:CustomValidator>
<asp:Button ID="UpdateBtn" runat="server" Text="Update" ValidationGroup="vg" />



Thanks,
Princy.
Tags
ComboBox
Asked by
Craig Wallace
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or