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

Radcombobox client validation being triggered on scroll

3 Answers 63 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Soumya Kommireddi
Top achievements
Rank 1
Soumya Kommireddi asked on 09 Jul 2012, 11:49 PM
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" />

3 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 10 Jul 2012, 06:41 AM
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.
0
Soumya Kommireddi
Top achievements
Rank 1
answered on 11 Jul 2012, 03:56 PM
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?
0
Dimitar Terziev
Telerik team
answered on 16 Jul 2012, 07:53 AM
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.
Tags
ComboBox
Asked by
Soumya Kommireddi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Soumya Kommireddi
Top achievements
Rank 1
Dimitar Terziev
Telerik team
Share this question
or