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

[Solved] How to bind selected item/value to a model property?

3 Answers 284 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.
Brady
Top achievements
Rank 1
Brady asked on 16 Dec 2010, 11:39 AM
The standard MVC helper DropDownFor takes a model property lambda, and the selection of the dropdown is bound to this model property.  In the Telerik ComboBox I can only find a BinbTo method, which only concerns binding of the list items, not the selected value.  How do I achieve binding of the selected value?

3 Answers, 1 is accepted

Sort by
0
al
Top achievements
Rank 1
answered on 20 Dec 2010, 12:24 AM
var body = $('#ddlBodyStyle'+catID).data('tDropDownList');
            body.dataBind(data);  
            body.select(0);
var body = $('#ddlBodyStyle'+catID).data('tDropDownList');
            body.dataBind(data);  
            body.select(0);
var body = $('#ddlBodyStyle'+catID).data('tDropDownList');
            body.dataBind(data);  
            body.select(0);
var body = $('#ddlBodyStyle'+catID).data('tDropDownList');
            body.dataBind(data); 
            body.select(0);
var body = $('#ddlBodyStyle'+catID).data('tDropDownList');
            body.dataBind(data);  
            body.select(0);
var body = $('#ddlBodyStyle'+catID).data('tDropDownList');
            body.dataBind(data);  
            body.select(0);
0
al
Top achievements
Rank 1
answered on 20 Dec 2010, 12:27 AM
You could use the select method after binding it, i use the select with the index.
var body = $('#test').data('tDropDownList');
            body.dataBind(data);  
            body.select(0);

Cheers
0
Brady
Top achievements
Rank 1
answered on 20 Dec 2010, 09:38 AM
Thanks al, but all I had to do was use the Telerik 'ComboBoxFor'.  I didn't see this in the help example, and Intellisense is a little murky right now, so I just thought it didn't exist.
Tags
ComboBox
Asked by
Brady
Top achievements
Rank 1
Answers by
al
Top achievements
Rank 1
Brady
Top achievements
Rank 1
Share this question
or