Radcombobox client validation being triggered on scroll

4 posts, 1 answers
  1. Soumya Kommireddi
    Soumya Kommireddi avatar
    4 posts
    Member since:
    Sep 2009

    Posted 09 Jul 2012 Link to this post

    I have a radcombox with custom validator for checking if any item is selected in the list; I have virtual scrolling enabled. When I search for items containing some text, the items are populating in the combobox and if there are many items, the scroll bar is showing. When I select the scroll down arrow , the validation is getting triggered. Ideally it should not as I am just scrolling. The validation should only trigger when I do not select an item in the radcombobox and I lose control focus. Is this a bug in telerik?

    <telerik:RadComboBox ID="ListSelect" runat="server" Width="192px" EnableLoadOnDemand="true"      ShowMoreResultsBox="true" EnableVirtualScrolling="true" WebServiceSettings-Path="../../ws/AutoSuggest/AutoSuggest.asmx"  AllowCustomText="true" Filter="Contains" OnClientItemsRequesting="SearchAutoSuggest"      WebServiceSettings-Method="GetResults" OnClientSelectedIndexChanged="SelectAutoSuggestValue" AutoPostBack="false" MaxHeight="400px" OnClientDropDownOpening="selectText" MarkFirstMatch="true"  OnClientItemsRequested="highlightText" OnClientDropDownOpened="highlightText"   >
      </telerik:RadComboBox>
                                  
                                    <asp:CustomValidator ID="Validator_PatientGroupSelect" runat="server" ControlToValidate="ListSelect" ClientValidationFunction="checkValidSelection" />
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 10 Jul 2012 Link to this post

    Hi,

    Try the following Javascript to achieve your scenario.

    JS:
    <script type="text/javascript">
     var flag = 1;
     function selectText(sender, args)  // OnClientDropDownOpening
     {
      flag = 0;
      //Your code
     }
     function OnClientDropDownClosed(sender, args)
     {
      flag = 1;
     }
     function checkValidSelection(sender, args)
     {
      if (flag == 1)
      {
       //Your code
      }
      else
      {
        return;
      }
     }
    </script>

    Hope this helps.

    Thanks,
    Princy.
  3. Soumya Kommireddi
    Soumya Kommireddi avatar
    4 posts
    Member since:
    Sep 2009

    Posted 11 Jul 2012 Link to this post

    The solution would solve the problem, but in my opinion it seems like a bug in radcombobox control. Client validation should not be triggering on scroll right? What do you think?
  4. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 16 Jul 2012 Link to this post

    Hello,

    The validation is triggered when a callback or a postback is being made to the server. In your particular scenario a request (callback) for items is being made whenever the drop-down is scrolled since the following properties are being set: ShowMoreResultsBox="true" EnableVirtualScrolling="true".

    Greetings,
    Dimitar Terziev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top