how to pass textbox values from view to controller in MVC
here is my code.
view:(DisplayCustomer)
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>DisplayCustomer</title>
</head>
<body>
<div>
customer id is :-<%=Model.Id %><br />
customer code is :- <%=Model .CustomerCode %><br />
<%if (Model .Amount >100){ %>
previlaged customer
<% } else { %>
Normal customer
<%} %>
</div>
</body>
</html>
Controller:
[HttpPost]
public ActionResult DisplayCustomer()
{
Customer obj = new Customer();
obj.Id = Convert.ToInt16(Request.Form["CustomerId"]);
obj.CustomerCode = Request.Form["CustomerCode"].ToString();
obj.Amount = Convert.ToDouble(Request.Form["Amount"]);
return View(obj);
}
Thanks