This question is locked. New answers and comments are not allowed.
Hi,
I'm using for the first time telerik for my asp.net mvc forms.
I've a question about how to bind it to my model.
I've no problem to bind the comboBox to the list which contains all values, but I can't find how I can bind the selected id to one property of my model.
In camparison, with the dropDownList , I was using the
@Html.DropDownListFor(x=>x.MyProperty, ...)
But here I can't find any method like this, what is the correct way?
I'm using for the first time telerik for my asp.net mvc forms.
I've a question about how to bind it to my model.
I've no problem to bind the comboBox to the list which contains all values, but I can't find how I can bind the selected id to one property of my model.
In camparison, with the dropDownList , I was using the
@Html.DropDownListFor(x=>x.MyProperty, ...)
But here I can't find any method like this, what is the correct way?
5 Answers, 1 is accepted
0
Hello Julien,
This will get the value of the MyProperty and will set the selected item.
Regards,
Georgi Krustev
the Telerik team
I will suggest you use:
@Html.Telerik().DropDownListFor(x=>x.MyProperty)Regards,
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
0
Julien
Top achievements
Rank 1
answered on 08 Feb 2012, 03:38 PM
Okay, but this will generate me only a dropdown list no? I need to have the comboBox like it works here http://demos.telerik.com/aspnet-mvc/combobox
And I can't see how to specify which values can be used in the combo box
And I can't see how to specify which values can be used in the combo box
0
Hello Julien,
Regards,
Georgi Krustev
the Telerik team
In that case you will need to use ComboBoxFor:
@(Html.Telerik().ComboBoxFor(x=>x.MyProperty)
.BindTo(data)
)Regards,
Georgi Krustev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Le
Top achievements
Rank 1
answered on 21 Jun 2012, 09:38 AM
Thanks so much,
0
Andy
Top achievements
Rank 1
answered on 03 Aug 2012, 06:56 PM
Hi Georgi,
Your snippet works only so long as the control does not have a name. However, if you specify a control name, it appears to stop working:
Any suggestions?
Your snippet works only so long as the control does not have a name. However, if you specify a control name, it appears to stop working:
@(Html.Telerik().ComboBoxFor(x=>x.MyProperty) .Name("myName") .BindTo(data) )Any suggestions?