asp.net mvc 4 - View to Controller Data Conversion -


working on mvc4 + jquery software.

on jquery front-end/ui, configured "go" button to:

  1. put related form data data object
  2. call var datatosend = json.stringify(data)
  3. send ajax post request datatosend

for server-side controller, i've noticed there methods (whose names match controller routes' actions) contain argument inputs, such int or string.

how client-side json gets converted int or string server-side controller? need convert json data in way?

no, don't have special. mvc model binder work it's magic , it's best map post data action parameters (it attempt map them name). don't typically have worry doing type conversion; model binder you.

here's excellent primer on how mvc model binder works ootb: http://dotnetslackers.com/articles/aspnet/understanding-asp-net-mvc-model-binding.aspx


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

node.js - Node - Passport Auth - Authed Post Route hangs on form submission -

Does Firefox offer AppleScript support to get URL of windows? -