I am recently started learning MVC3. I designed a web application, I am not able to use the form tag by the Razor engine, Have a look at the below code
<html>
<head>
<title>Index</title>
</head>
<body>
<div>
@using (Html.BeginForm("Index","Data", FormMethod.Post))
{
<table>
<tr>
<td>
@Html.Label("Enter Your Name:")
</td>
<td>
@Html.TextBox("Name")
</td>
</tr>
<tr>
<td>
@Html.Label("Enter your Age:")
</td>
<td>@Html.TextBox("Age")
</td>
</tr>
<tr>
<td>
Select Your Gender:
</td>
<td>
@Html.RadioButton("N_Gender", "M")<span>Male</span>
@Html.RadioButton("N_Gender", "F")<span>Female</span>
</td>
</tr>
<tr>
<td>
<input type="submit" value="Submit" />
</td>
<td>
<button type="reset" value="reset" />
Reset</button>
</td>
</tr>
</table>
}
</div>
When I run this application I am getting an error like Server Error in '/' Application. Parser Error "Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Encountered end tag "table" with no matching start tag. Are your start/end tags properly balanced?"
Your HTML is badly formatted
try like this
<html>
<head>
<title>Index</title>
</head>
<body>
<div>
@using (Html.BeginForm("Index","Data", FormMethod.Post))
{
<table>
<tr>
<td>
@Html.Label("Enter Your Name:")
</td>
<td>
@Html.TextBox("Name")
</td>
</tr>
<tr>
<td>
@Html.Label("Enter Your Age:")
</td>
<td>
@Html.TextBox("N_Age")
</td>
</tr>
<tr>
<td>
@Html.Label("Enter Your Gender:")
</td>
<td>
@Html.RadioButton("Gender""M")<span>Male</span>
@Html.RadioButton("Gender""F")<span>Female</span>
</td>
</tr>
<tr>
<td>
<input type="submit" value="Submit" />
</td>
<td>
<button type="reset" value="reset">
Reset<button>
</td>
</tr>
</table>
}
</div>
</body>
</html>