Hi,
In one of a form in our application we have a rad combo which updates itself with data everytime we change some parameters in form. We are using a webservice to get the list of RadComboItemData and bind on the client side.
When we bind whats happening is that the last selected text still remains visible even if its not in the new list. We have a required field validator for the list. If I manually do select on the first item (First item displays a message that an item must be selected) of the new list using comboItem.Select() it launches validation and dispalys our required field validator that an item must be selected.
Is there a proper way of doing it so that new list populates itself without any garbage left over from the last binded data?
My second question is can we do validation on value of the selected item instead of text?
Thanks in advance for your help.
Best regards,
Khurram
Client side binding function
In one of a form in our application we have a rad combo which updates itself with data everytime we change some parameters in form. We are using a webservice to get the list of RadComboItemData and bind on the client side.
When we bind whats happening is that the last selected text still remains visible even if its not in the new list. We have a required field validator for the list. If I manually do select on the first item (First item displays a message that an item must be selected) of the new list using comboItem.Select() it launches validation and dispalys our required field validator that an item must be selected.
Is there a proper way of doing it so that new list populates itself without any garbage left over from the last binded data?
My second question is can we do validation on value of the selected item instead of text?
Thanks in advance for your help.
Best regards,
Khurram
Client side binding function
function bindCombo(combo,result){ |
var items = combo.get_items(); |
items.clear(); |
for(var i=0;i< result.length;i++){ |
var comboItem = new Telerik.Web.UI.RadComboBoxItem(); |
comboItem.set_text(result[i].Text); |
comboItem.set_value(result[i].Value); |
items.add(comboItem); |
if (i == 0) { |
comboItem.select(); |
} |
} |
} |
11 Answers, 1 is accepted
0
Hello Khurram,
I suggest you use combo.set_text(""); right after items.clear(); to clear the selected item. As to your second question, RadComboBox cannot be validated on value with RequiredFieldValidator, but you can create your custom validator, please check this help topic which shows how to do that.
Best wishes,
Yana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I suggest you use combo.set_text(""); right after items.clear(); to clear the selected item. As to your second question, RadComboBox cannot be validated on value with RequiredFieldValidator, but you can create your custom validator, please check this help topic which shows how to do that.
Best wishes,
Yana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

khurram
Top achievements
Rank 1
answered on 24 Sep 2008, 02:45 PM
Hi,
We are still having this issue where even if I select values on client side and validation passes; on server side I dont get the newly selected value. Can anyone suggest me what could be causing it?
Thanks in advance.
Regards,
Khurram
We are still having this issue where even if I select values on client side and validation passes; on server side I dont get the newly selected value. Can anyone suggest me what could be causing it?
Thanks in advance.
Regards,
Khurram
0
Hello Khurram,
I suggest you use trackChanges() and commitChanges() client-side methods to preserve changes you make after postback like this:
Hope this helps.
Regards,
Yana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I suggest you use trackChanges() and commitChanges() client-side methods to preserve changes you make after postback like this:
combo.trackChanges(); |
comboItem.select(); |
combo.commitChanges(); |
Hope this helps.
Regards,
Yana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

khurram
Top achievements
Rank 1
answered on 26 Sep 2008, 01:53 PM
Thanks Yana,
It did work but unfortunately the creation of combo on client side has become really slow. We have a form with combos changing a lot with different actions and we need a really high performance way of doing that. I am using the following code to populate it.
Is there another way of binding that for better performance. We are using a webservice call to get the list of RadComboBoxItemData[] items.
Thanks in advance for your help.
Regards,
Khurram
It did work but unfortunately the creation of combo on client side has become really slow. We have a form with combos changing a lot with different actions and we need a really high performance way of doing that. I am using the following code to populate it.
function bindCombo(combo, result) { |
combo.trackChanges(); |
var items = combo.get_items(); |
items.clear(); |
for (var i = 0; i < result.length; i++) { |
var comboItem = new Telerik.Web.UI.RadComboBoxItem(); |
comboItem.set_text(result[i].Text); |
comboItem.set_value(result[i].Value); |
items.add(comboItem); |
if (i == 0) { |
comboItem.select(); |
} |
} |
combo.commitChanges(); |
} |
Is there another way of binding that for better performance. We are using a webservice call to get the list of RadComboBoxItemData[] items.
Thanks in advance for your help.
Regards,
Khurram
0

khurram
Top achievements
Rank 1
answered on 13 Feb 2009, 07:32 PM
Any info regarding the slowness of databinding on client side?
Thanks for your help.
regards,
Khurram
Thanks for your help.
regards,
Khurram
0
Hi Khurram,
I am not able to understand why you need client-side databinding when you're using a web service to get the items, why don't you bind the combobox directly to the web service?
Regards,
Yana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I am not able to understand why you need client-side databinding when you're using a web service to get the items, why don't you bind the combobox directly to the web service?
Regards,
Yana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

khurram
Top achievements
Rank 1
answered on 16 Feb 2009, 02:59 PM
Hi,
I dont know how this load on demand example can be used in our context as in our case combos are populated based on certain fields changed by a user in a form. For example a user selects different items in a radiobutton list and that will update the items of the combo accordingly. So to avoid a postback on change of radiobuttonlist we call a webservice and bind the new items to our combo on client-side.
Regards,
Khurram
I dont know how this load on demand example can be used in our context as in our case combos are populated based on certain fields changed by a user in a form. For example a user selects different items in a radiobutton list and that will update the items of the combo accordingly. So to avoid a postback on change of radiobuttonlist we call a webservice and bind the new items to our combo on client-side.
Regards,
Khurram
0
Hello Khurram,
I suggest you use the context object to pass information when you request items. Please check this help article for details. Also you're using an old version of the controls, there are some improvements concerning performance in our latest release.
Kind regards,
Yana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I suggest you use the context object to pass information when you request items. Please check this help article for details. Also you're using an old version of the controls, there are some improvements concerning performance in our latest release.
Kind regards,
Yana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Anshuman
Top achievements
Rank 1
answered on 16 May 2014, 05:07 AM
Hi
I have bind dropdown ddlColumn with pagemethod(GetColumnList) this is working fine on opening dropdown but after adding a item client side in this dropdown then it is not binding comlete list from page mathod it showing only one item that is added by client code. i want to rebind or want to refresh the list on opening dropdown.
HTML:
<telerik:RadComboBox ID="ddlColumn" runat="server" Width="250px"
Height="150px" EnableLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true"
OnClientSelectedIndexChanged="SelectedIndexChanged" >
<WebServiceSettings Method="GetColumnList" Path="TestPage.aspx" />
</telerik:RadComboBox>
Server:
[WebMethod(EnableSession = true)]
public static RadComboBoxData GetColumnList(RadComboBoxContext context)
{}
Thanks in advance
Anshuman
I have bind dropdown ddlColumn with pagemethod(GetColumnList) this is working fine on opening dropdown but after adding a item client side in this dropdown then it is not binding comlete list from page mathod it showing only one item that is added by client code. i want to rebind or want to refresh the list on opening dropdown.
HTML:
<telerik:RadComboBox ID="ddlColumn" runat="server" Width="250px"
Height="150px" EnableLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true"
OnClientSelectedIndexChanged="SelectedIndexChanged" >
<WebServiceSettings Method="GetColumnList" Path="TestPage.aspx" />
</telerik:RadComboBox>
Server:
[WebMethod(EnableSession = true)]
public static RadComboBoxData GetColumnList(RadComboBoxContext context)
{}
Thanks in advance
Anshuman
0

Shinu
Top achievements
Rank 2
answered on 16 May 2014, 10:20 AM
Hi Anshuman,
Please try the following JavaScript to add a new item to the RadComboBox which works fine at my end.
JavaScript:
Let me know if you have any concern.
Thanks,
Shinu.
Please try the following JavaScript to add a new item to the RadComboBox which works fine at my end.
JavaScript:
function
AddItem(sender, args) {
var
combo = $find(
"<%= RadComboBox1.ClientID %>"
);
var
comboItem =
new
Telerik.Web.UI.RadComboBoxItem();
comboItem.set_text(
"New Item"
);
combo.trackChanges();
combo.get_items().add(comboItem);
comboItem.select();
combo.commitChanges();
}
Let me know if you have any concern.
Thanks,
Shinu.
0

Anshuman
Top achievements
Rank 1
answered on 19 May 2014, 05:06 AM
Hi Shinu
Thanks for your response, i have code in same fashion, if it is working at your end then might be some issue in my dll version of code, now i have code in another way
Thanks again
Anshuman
Thanks for your response, i have code in same fashion, if it is working at your end then might be some issue in my dll version of code, now i have code in another way
Thanks again
Anshuman