Hi,
I need to select a combobox item programatically via javascript.
This does not work for an auto complete combo box which get its items from a web service:
ddlDriverA.trackChanges();
var item = ddlDriverA.findItemByValue(driverName);
item.select();
ddlDriverA.commitChanges();
I'm working with version 2011.1.413.40
I tried several options with no luck...
I need to select a combobox item programatically via javascript.
This does not work for an auto complete combo box which get its items from a web service:
ddlDriverA.trackChanges();
var item = ddlDriverA.findItemByValue(driverName);
item.select();
ddlDriverA.commitChanges();
I'm working with version 2011.1.413.40
I tried several options with no luck...
4 Answers, 1 is accepted
0

Casey
Top achievements
Rank 1
answered on 13 Dec 2011, 07:25 PM
Hello,
Do you get an error, or does it just not select the item?
When are you calling the javascript function to select that item?
The following works for me to select an item via javascript:
Do you get an error, or does it just not select the item?
When are you calling the javascript function to select that item?
The following works for me to select an item via javascript:
function
pageLoad(sender, args) {
var
combo = $find(
"<%= RadComboBox1.ClientID %>"
);
if
(combo !=
null
) {
var
itm = combo.findItemByValue(
"0"
);
if
(itm !=
null
){
itm.select();
}
}
}
0
Hi Casey,
If the item you are trying to select is present in the RadComboBox's item collection, the approach suggested by Casey should work fine. The select() method does select the specified item. More information about the client-side object of the RadComboBoxItem could be found at the following help article: RadComboBoxItem Object.
Could you provide us with some more information about the scenario you are trying to implement? You could also open a support ticket where a sample page illustrating the issues, can be attached to the message.
Regards,
Ivana
the Telerik team
If the item you are trying to select is present in the RadComboBox's item collection, the approach suggested by Casey should work fine. The select() method does select the specified item. More information about the client-side object of the RadComboBoxItem could be found at the following help article: RadComboBoxItem Object.
Could you provide us with some more information about the scenario you are trying to implement? You could also open a support ticket where a sample page illustrating the issues, can be attached to the message.
Regards,
Ivana
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
0

Doron
Top achievements
Rank 1
answered on 18 Dec 2011, 08:26 AM
Hi,
Thanks for the answers.
As i mentioned before, my combo is not populated. It's an auto complete combo which retrieves data from a service:
<telerik:RadComboBox Style="padding-bottom: 3px;" ID="cmbDriversDiv" Skin="GRSkin"
EnableEmbeddedSkins="false" Width="200px" Filter="None" runat="server" MarkFirstMatch="false"
EnableTextSelection="true" AutoPostBack="false" AllowCustomText="true" OnClientItemsRequestFailed="onNodePopulationFailed"
EnableViewState="false" Sort="Ascending" EnableLoadOnDemand="true" Height="160">
<WebServiceSettings Method="GetDrivers" Path="~/Services/EntitiesSelector.asmx" />
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</telerik:RadComboBox>
Above is a list of users (after inserting more than 3 chars). There are some cases in which i need to select a default user but the combo is not populated yet.
THNX
Thanks for the answers.
As i mentioned before, my combo is not populated. It's an auto complete combo which retrieves data from a service:
<telerik:RadComboBox Style="padding-bottom: 3px;" ID="cmbDriversDiv" Skin="GRSkin"
EnableEmbeddedSkins="false" Width="200px" Filter="None" runat="server" MarkFirstMatch="false"
EnableTextSelection="true" AutoPostBack="false" AllowCustomText="true" OnClientItemsRequestFailed="onNodePopulationFailed"
EnableViewState="false" Sort="Ascending" EnableLoadOnDemand="true" Height="160">
<WebServiceSettings Method="GetDrivers" Path="~/Services/EntitiesSelector.asmx" />
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</telerik:RadComboBox>
Above is a list of users (after inserting more than 3 chars). There are some cases in which i need to select a default user but the combo is not populated yet.
THNX
0
Hello Alon,
When loading the items on demand, the request for them is made on drop-down list opening or when the user types in the input are of the RadComboBox. There is really no situation when the items are not loaded, unless you have customized the load on demand mechanism, to make a request for items when certain criteria is satisfied. For more information, you could take a look at the following help article at our website: RadComboBox / Load On Demand Overview.
Could you give us a little bit more information about the scenario you are trying to implement? In which moment do you populate the items in the RadComboBox? Which method do you use to accomplish it?
If you are still having troubles, you could send us a sample page with the issues isolated in it. This way we will be able to troubleshoot the issues locally and determine how your scenario could be achieved.
Information how to isolate a problem into a sample page is available at the following link: Isolating a problem in a sample project.
Kind regards,
Ivana
the Telerik team
When loading the items on demand, the request for them is made on drop-down list opening or when the user types in the input are of the RadComboBox. There is really no situation when the items are not loaded, unless you have customized the load on demand mechanism, to make a request for items when certain criteria is satisfied. For more information, you could take a look at the following help article at our website: RadComboBox / Load On Demand Overview.
Could you give us a little bit more information about the scenario you are trying to implement? In which moment do you populate the items in the RadComboBox? Which method do you use to accomplish it?
If you are still having troubles, you could send us a sample page with the issues isolated in it. This way we will be able to troubleshoot the issues locally and determine how your scenario could be achieved.
Information how to isolate a problem into a sample page is available at the following link: Isolating a problem in a sample project.
Kind regards,
Ivana
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