Skip to content

Instantly share code, notes, and snippets.

@gabriel403
Created April 19, 2012 17:07
Show Gist options
  • Save gabriel403/2422345 to your computer and use it in GitHub Desktop.
Save gabriel403/2422345 to your computer and use it in GitHub Desktop.
When posting and specifying an obj in the args where the member vars of the obj match to the names of form elements
//object
namespace something
{
public class SomeObj
{
public string SomeStr;
}
}
//view with a form that posts to SomePostedAction
<form>
<input type="text" name="someStr" />
</form>
//put 'some text' in the input
//controller action
public ActionResult SomePostedAction(SomeObj someObj)
{
//'some text' == someOBj.SomeStr
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment