ClientValidationFunction being called on SelectedIndexChanged?

2 posts, 0 answers
  1. Craig Wallace
    Craig Wallace avatar
    118 posts
    Member since:
    Jan 2005

    Posted 05 Oct 2010 Link to this post

    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.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Oct 2010 Link to this post

    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.
Back to Top