
Hi,
Here is the code..
Step 1:
Open your controller and write an action method as below..
public ActionResult Register()
{
return View();
}
Step 2:
Right-click on modes folder and add a model (Details.cs) and declare the following properties..
public class Details()
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string EmailID { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public string ConfirmPassword { get; set; }
public long ContactNo { get; set; }
}
public class Login
{
public string UserID { get; set; }
public string Password { get; set; }
}
Step 3:
Create a view for the action method Register (Register.cshtml).
Check the create a strongly- typed checkbox and add the details model.
Open the view and write the following code..
@model JobSiteSeekers.Models.Details
@{
ViewBag.Title = "Register";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<script type="text/javascript">
function handleWizardNext() {
if (document.getElementById('ButtonNext').name == 'Step2') {
document.getElementById('ButtonNext').name = '';
document.getElementById('ButtonNext').disabled = 'disabled';
document.getElementById('ButtonPrevious').name = 'Step1';
document.getElementById('ButtonPrevious').disabled = '';
document.getElementById('Step1').style.display = 'none';
document.getElementById('Step2').style.display = '';
}
}
function handleWizardPrevious() {
if (document.getElementById('ButtonPrevious').name == 'Step1') {
document.getElementById('ButtonNext').name = 'Step2';
document.getElementById('ButtonPrevious').name = '';
document.getElementById('ButtonNext').disabled = '';
document.getElementById('ButtonPrevious').disabled = 'disabled';
document.getElementById('Step2').style.display = 'none';
document.getElementById('Step1').style.display = '';
}
else if (document.getElementById('ButtonPrevious').name == 'Step2') {
document.getElementById('ButtonNext').name = '';
document.getElementById('ButtonPrevious').name = 'Step1';
document.getElementById('Step2').style.display = '';
}
}
function submitForm() {
document.fmReg.submit();
}
</script>
@using (Html.BeginForm("Register", "Home", FormMethod.Post, new { id = "fmReg", name = "fmReg" }))
{
<div align="center" style="background-color: Black; color: Orange; font-weight: bold; width:83%;
font-size: x-large">
Sign Up here!
</div>
<div align="center">
@*<asp:Label ID="Label2" runat="server" Text="Employees/ Employers! Register here!!"
SkinID="FormHeading"></asp:Label>*@
@Html.Label("Label2", "Employees/ Employers! Register here!!")
</div>
<br />
<p>
Registration is a two step process:</p>
<br />
<ol>
<li>Choose a user name and password</li><li>Choose whether you would like to register
as an "Employee" or "Employer".</li></ol>
<p>
Once you register with us you can access respective secured areas for posting resumes
or posting jobs.</p>
<div align="center" id="wizard">
<span id="Step1">
<table border="0" cellpadding="5" cellspacing="0">
<tr>
<td align="right">
First name:
</td>
<td>
<input id="TextFirstName" name="FirstName" type="text" />
</td>
</tr>
<tr>
<td align="right">
Last name:
</td>
<td>
<input id="TextLastName" name="LastName" type="text" />
</td>
</tr>
</table>
</span><span id="Step2" style="display: none">
<table border="1" style="background-color: #ffffee">
<tr>
<td align="right" style="font-weight: bold; font-size: medium;">
@Html.LabelFor(model => model.FirstName) :
</td>
<td>
@Html.TextBoxFor(model => model.FirstName)
</td>
</tr>
<tr>
<td align="right" style="font-weight: bold; font-size: medium;">
@Html.LabelFor(model => model.LastName) :
</td>
<td>
@Html.TextBoxFor(model => model.LastName)
</td>
</tr>
<tr>
<td align="right" style="font-weight: bold; font-size: medium;">
@Html.LabelFor(model => model.EmailID)
</td>
<td>
@Html.TextBoxFor(model => model.EmailID)
</td>
</tr>
<tr>
<td align="right" style="font-weight: bold; font-size: medium;">
@Html.LabelFor(model => model.UserName) :
</td>
<td>
@Html.TextBoxFor(model => model.UserName)
</td>
</tr>
<tr>
<td align="right" style="font-weight: bold; font-size: medium;&qu
Kavya Shree Mandapalli
Varun66, if this helps please login to Mark As Answer. | Alert Moderator