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

ComboBox problem with MVC model binding

0 Answers 133 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 21 Sep 2012, 07:18 PM
I am using comboboxes in a Kendo grid, and have not had any problem with the model binding working when the data is posted back to the server by the grid.  However, I just tried using a Kendo ComboBox in a traditional form that does a standard post (instead of an ajax post), and model binding does not work.  The reason is that the posted values don't match the MVC conventions for child properties.  

A quick example:

Let's say you have a combobox bound to an Employee property in your view model, and the Employee object has two child properties - EmployeeName and EmployeeId.

If you look at the ajax post of the data when this ComboBox is used in the grid it looks like this:

Employee.EmployeeId
Employee.EmpoyeeName

But when you put the the same ComboBox in a standard form, and post back to the server, the values are posted like this:

Employee
Employee_input 

This causes the form data not to be bound to the model accepted by the controller action method, since this naming standard does not follow the MVC binding conventions.  Why does this control behave differently in these two scenarios, and how can I make it start working in my forms?  Is there a Kendo model binder I need to register in my project?  This is a rather urgent issue, as we are getting ready to launch a Kendo Grid implementation, and this is breaking the existing forms now that they have been converted to use Kendo Comboboxes.  

I already created a support ticket for this, but thought I would try the forums as well, as I need to find a solution ASAP.

Thanks, DanO

No answers yet. Maybe you can help?

Tags
ComboBox
Asked by
Dan
Top achievements
Rank 1
Share this question
or