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.

<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

Popular posts from this blog

How to use lamda expression for updating using LINQ

using session for login and logout in asp.net