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

[Solved] Add option to a comboBox

1 Answer 98 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Julien
Top achievements
Rank 1
Julien asked on 27 Feb 2012, 02:56 PM
Hi,

How can I add a possible value to a combobox? 

My combobox is bound on the server and I want to add one element from the client side(because I just create an element throught ajax)

I searched here http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-combobox-client-api-and-events.html#ClientMethods 

But I didn't found anything like that.

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 29 Feb 2012, 09:50 AM
Hello,

 
You will need to modify the data of the combobox and then rebind it. Check the following code snippet:

var combobox = $("#combobox").data("tComboBox");
var data = combobox.data;
 
//modify data
data.push({ Text: "New", Value: "1000"});
 
combobox.dataBind(data)
All the best,
Georgi Krustev
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
ComboBox
Asked by
Julien
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or