Customising the format of the data send to the server on 'create' action

Customising the format of the data send to the server on 'create' action

NathanHadleyNathanHadley Posts: 3Questions: 1Answers: 0

Hello all,

I am using datatables with the editor extension to post data to an ASP.NET MVC backend. The action I am calling expects a complex object which I would like it to be able to automatically find the property values for using default model binding.

My problem is the default model binding expects the fields to have EXACTLY the same names as the public properties defined by my object. So when the table POSTs the data data as data[name]="name" it can't find the value for the property 'Name'.

I can work around this problem by defining a custom model binder, but I have a lot of models I will be working with so would rather be able to reformat the data send by the table so that the default model binder can find it e.g. name="name".

Can this be done?

Thanks

Nathan

This discussion has been closed.