How to post data in MVC using form collection for Beginners.
Here we can simply put the data into the form tag and give each component an name .We are creating a login form using the MVC Architecture.
public ActionResult Name_of_the_function(formcollection form)
{
string str=form["username"];
string str1= form["pass"];
}
<form method="post" action="Name_of_the_function>
<input type="text" name=username id=username>
<input type="password" name =pass id=pass>
<input id=submit type="submit">
on controller
[httppost]
public ActionResult Name_of_the_function(formcollection form)
{
string str=form["username"];
string str1= form["pass"];
}
Comments
Post a Comment