Working with HTML forms in MVC
To work with HTML forms in MVC we use begin form () and end form () in HTML helper classes
Go to home folder in view
↓
Create a new page with the name sample2
↓
Learn ASP.Net by Tekslate - Fastest growing sector in the industry.Explore Online ASP.Net Training and course is aligned with industry needs & developed by industry veterans.
Tekslate will turn you into ASP.Net Expert.
Go to source part
Write the following code to create the design of the form
<body>
<div>
<h1>welcome to satya technologies</h1>
<%HTML.begin form();%>
<%=HTML.label(“enter user name”)%>
<%=HTML.text box(“T1”)%></br>
<button id=”B1” type =”submit”>submit</button>
<%HTML.end form();%>
Go to home control.cs write the following code for create an action method for sample2
Public action result sample2()
{
Return view ();
}
Go to global.asax change action name to sample2 and sum the application and check
For indepth understanding click on