Issues With asp Validation Controls

3 posts, 0 answers
  1. Abdallah
    Abdallah avatar
    7 posts
    Member since:
    Jan 2011

    Posted 05 Feb 2011 Link to this post

    Dear all,

    1-Please i used a asp required validation controls with radcombo box and the InitialValue property of required validation not working .
    2-other controls is working only in the first view of the page if the page is posted back the validation not working ..
    Please help me in this .
     
    Best Regards 
  2. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 07 Feb 2011 Link to this post

    Hello Abdallah,

    I would suggest using a CustomValidator and writing the javascript to validate the control. Like so:

    ASP.NET:
    <asp:CustomValidator ID="CustomValidator1" runat="server" Display="Dynamic" ValidationGroup="Save"
                        ClientValidationFunction="ValidateRadComboBox">*<asp:CustomValidator>

    JavaScript:
    function ValidateRadComboBox(source, args){
        var combo = $find("RadComboBox1.ClientID");
          
        args.IsValid = combo.get_selectedIndex() > 0;
    }

    That's pretty much it. You'll need to handle the server-side check for the CustomValidator by handling the OnServerValidate event.

    I hope that helps.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Thad
    Thad avatar
    106 posts
    Member since:
    Sep 2010

    Posted 08 Feb 2011 Link to this post

    Hey Abdallah,

    One thing that got me for a bit was that the RequiredFieldValidator works on the TEXT property of a RadComboBox, not on the Value property like a normal DropDownList.

    It might be that you just need to change the InitialValue to something that represents the textual value of the default item.

    Hope that helps,
    Thad
Back to Top