How to insert my model properties into this login bootstrap form? - asp.net-mvc

Is it possible to put the model properties in this styled login form? I don't know where to put the lambda helpers (x=>x.email, x=>x.password etc). Any help is appreciated.
#model User
#using (Html.BeginForm("LogIn", "Account", FormMethod.Post, new { #class = "form-horizontal", role = "form" }))
{
<div class="container">
<div class="row">
<p><br></p>
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-default">
<div class="panel-body">
<div class="page-header">
<h3>Welcome Back! Please Sign In</h3>
</div>
<div class="form-group">
#Html.LabelFor(x => x.Username)
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
#Html.EditorFor(x => x.Username, new { htmlAttributes = new { #class = "form-control" } })
</div>
</div>
<div class="form-group">
#Html.LabelFor(x => x.Password)
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
#Html.EditorFor(x => x.Password, new { htmlAttributes = new { #class = "form-control" } })
</div>
</div>
<hr />
<button type="button" class="btn btn-success"><span class="glyphicon glyphicon-arrow-left"></span> Back</button>
<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-log-in"></span> Login</button>
<div>
<h3 class="page-header">No Account? Sign Up, Its Free</h3>
</div>
<button type="button" class="btn btn-primary" />
Sign Up
<span class="glyphicon glyphicon-check"></span>
</div>
</div>
</div>
</div>
</div>
}
#section Scripts {
#Scripts.Render("~/bundles/jqueryval")
}
Edit:
the problem is now that i can't apply the wanted style on the input
i tried adding
#Html.EditorFor(x => x.Username, new { htmlAttributes = new{#class = "form-control"}}) and this also #Html.EditorFor(x => x.Username, new { #class = "form-control"}) and both doesnt work.
with adding above i`m trying to get this style:
but instead i'm getting these unstyled input boxes
2nd EDIT:
Instead of using :
#Html.EditorFor(x => x.Username, new { htmlAttributes = new { #class = "form-control" } })
I tried :
#Html.TextBoxFor(x => x.Username, new { #class = "form-control" })
and with this i'm getting the desired style, so i don`t exactly know the difference between Html.EditorFor and Html.TextBoxFor and if using Html.TextBoxFor is a good solution, maybe someone can clarify this.

As long as your Model is declared you can just change it to this:
<div class="container">
<div class="row">
<p><br></p>
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-default">
<div class="panel-body">
<div class="page-header">
<h3>Welcome Back! Please Sign In</h3>
</div>
<form role="form" method="post" action="/Users/LogIn">
<div class="form-group">
#Html.LabelFor(x => x.Username)
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
#Html.EditorFor(x => x.Username)
</div>
</div>
<div class="form-group">
#Html.LabelFor(x => x.Password)
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
#Html.EditorFor(x => x.Password)
</div>
</div>
<hr />
<button type="button" class="btn btn-success"><span class="glyphicon glyphicon-arrow-left"></span> Back</button>
<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-log-in"></span> Login</button>
<div>
<h3 class="page-header">No Account? Sign Up, Its Free</h3>
</div>
<button type="button" class="btn btn-primary">
Sign Up
<span class="glyphicon glyphicon-check"></span>
</button>
</form>
</div>
</div>
</div>
</div>
</div>
Also instead of using <form role="form" method="post" action="/Users/LogIn"> you can do the following:
#using (Html.BeginForm("LogIn", "Users", FormMethod.Post))
{
// DisplayFor and EditorFor code
}
You can read about the differences between and EditorFor and a TextBoxFor Here

Related

Radio-Buttons overlapping each other

I am building a form using bootstrap 4.3 with few Radio-Buttons, but the issue is, it overlaps each other as shown below.
I tried it in jsfiddle and the result is same. Here is my working in jsfiddle: https://jsfiddle.net/hifni/ky3xzej0/7/
My Razor page looks like this:
<div class="alert alert-info">
<p>The request will enable your Credit Balance to be in your account for future trading/settlement.</p>
<footer class="blockquote-footer">Subject to T&C</footer>
</div>
<style>
.form-control {
height: auto;
}
</style>
#using (Html.BeginForm())
{
#Html.AntiForgeryToken()
<div class="form">
<hr />
#Html.ValidationSummary(true, "", new { #class = "text-danger" })
<div class="form-group">
#Html.HiddenFor(model => model.AccountId)
<input type="hidden" id="tempStore" />
#Html.HiddenFor(model => model.SendSMS)
#Html.HiddenFor(model => model.RequiresApproval)
</div>
<div class="form-group">
<label>Pick a Settlement Mode</label>
<div class="form-control">
<div class="form-check">
#Html.RadioButtonFor(model => model.IsSettlementOnHold, "No", new { #class = "form-check-input", #id = "rbIsSettlementOnHold_No" })
#Html.Label("rbIsSettlementOnHold_No", "Standard ", new { #class = "form-check-label" })
#Html.RadioButtonFor(model => model.IsSettlementOnHold, "Yes", new { #class = "form-check-input", #id = "rbIsSettlementOnHold_Yes" })
#Html.Label("rbIsSettlementOnHold_Yes", "On Request ", new { #class = "form-check-label" })
#Html.ValidationMessageFor(model => model.IsSettlementOnHold, "", new { #class = "text-danger" })
</div>
</div>
</div>
<div class="form-group">
#Html.TextAreaFor(model => model.AdditionalNote, 3, 50, new { #class = "form-control", #placeholder = "Any Aditional Note" })
#Html.ValidationMessageFor(model => model.AdditionalNote, "", new { #class = "text-danger" })
</div>
<div class="form-group">
#*<input type="submit" value="Submit" class="btn btn-default" id="btnSelfServiceRequestSubmit"/>*#
<button type="submit"
class="btn btn-dark"
id="btnSelfServiceRequestSubmit"
#*data-toggle="modal"
data-target="#modalEntityDetail"
data-url="#Url.Action("_CodePrompt", "ExternalSelfServiceRequest")"*#>
Submit
</button>
<button type="reset"
class="btn btn-warning">
Reset
</button>
</div>
#if (Model.RequiresApproval.Equals("Yes"))
{
<div class="alert alert-info" role="alert">
For security verification purpose you will be required to access your JKSB Registered Mobile, there will
be a verification code sent to it.
</div>
}
</div>
}
Appreciate any help.
You can separate your "form-check" div like this;
<div class="form-control">
<div class="form-check form-check-inline">
<input checked="checked" class="form-check-input" id="rbIsSettlementOnHold_No" name="IsSettlementOnHold" type="radio" value="No">
<label for="rbIsSettlementOnHold_No" class="form-check-label"> Standard</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" id="rbIsSettlementOnHold_Yes" name="IsSettlementOnHold" type="radio" value="Yes">
<label for="rbIsSettlementOnHold_Yes" class="form-check-label"> On Request </label>
</div>
</div>
And using "form-check-inline" class will be provide you a horizontal alignment.
I hope this helps.

Select dropdown not displaying properly in the cshtml View

The dropdown on the image below do not display properly. I want the dropdown to cover the length of the Modal Popup. The Button on the page fire properly I have no issue with my Controller. Any help to resolve this issue will be appreciated
View Code
<a class="btn w-xs btn-primary" data-toggle="modal" data-target=".bootstrapmodal"><i class="fa fa-book" aria-hidden="true"></i><span id="#ViewBag.Group"> Add New Member</span></a>
<div class="modal fade bootstrapmodal ">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button data-dismiss="modal" class="close"><span>×</span></button>
<div class=" modal-title"><h3>Add User to Active Directory Group #ViewBag.Group </h3></div>
</div>
<div class="modal-body">
<div class="content">
#using (Html.BeginForm("AddNewUser", "ActiveDirectoryMember", FormMethod.Post, new { enctype = "multipart/form-data", id = "addUser" }))
{
#Html.ValidationSummary(true, "", new { #class = "text-danger" })
#Html.AntiForgeryToken()
<div class="panel ">
<div class="panel-body ">
<div class="form-horizontal">
<input type="hidden" name="groupName" value="#ViewBag.Group" />
<div class="form-group">
#Html.Label("Technician", new { #class = "control-label col-md-2 required" })
<div class="input-group">
<div class="col-md-8">
<select id="userId" name="userId" class="form-control s2-search-box2">
<option value="">Click search for a staff member</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-2">
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-success" id="addUser">
<i class="fa fa-plus-circle"></i>
Add New User
</button>
</div>
</div>
</div>
</div>
</div>
}
</div>
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal">
<i class="fa fa-ban"></i>
Cancel
</button>
</div>
</div>
</div>
</div>

How to keep selected tab as active after button click

Below is my code
In Update Tab when I select an email id - after return view it set again add tab as active (coz it was set as active by default).
How to set the update tab as active after selecting email id - any idea .
<ul class="nav nav-tabs">
<li role ='presentation' class="active">Add</li>
<li role ='presentation'>Update</li>
<li role ='presentation'>Delete</li>
<li role ='presentation'>Menu 3</li>
</ul>
<div class="tab-content">
<div id="Add" class="tab-pane active">
#using (Html.BeginForm("Add", "Admin"))
{
<div class="container container-fluid">
<br />
<div class="row">
<div class="col-lg-offset-1 col-lg-5">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-user-o" aria-hidden="true"></i>
</div>
#Html.TextBoxFor(m => m.user_name, new { #class = "form-control", #placeholder = "User Name", #required = "true" })
</div>
</div>
</div>
<div class="row">
<div class="col-lg-offset-1 col-lg-5">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-address-card-o" aria-hidden="true"></i>
</div>
#Html.TextBoxFor(m => m.full_name, new { #class = "form-control", #placeholder = "Full Name", #required = "true" })
</div>
</div>
</div>
<div class="row">
<div class="col-lg-offset-1 col-lg-5">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-inbox" aria-hidden="true"></i>
</div>
#Html.TextBoxFor(m => m.user_email, new { #class = "form-control", #placeholder = "Email id", #required = "true" })
</div>
</div>
</div>
<div class="row">
<div class="col-lg-offset-1 col-lg-5">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-lock" aria-hidden="true"></i>
</div>
#Html.TextBoxFor(m => m.password, new { #class = "form-control", #placeholder = "Password", #required = "true" })
</div>
</div>
</div>
<div class="row">
<div class="col-lg-offset-1 col-lg-5">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-universal-access fa-spin" aria-hidden="true"></i>
</div>
#Html.DropDownListFor(m => m.role, ViewBag.role as IEnumerable<SelectListItem>, new { #class = "form-control" })
</div>
</div>
</div>
<div class="row">
<div class="col-lg-offset-1 col-lg-5">
<button type="submit" class="btn btn-success btn-sm">
<i class="fa fa-check-square-o" aria-hidden="true"></i>
Add
</button>
</div>
</div>
</div>
}
</div>
<div id="Update" class="tab-pane">
#using (Html.BeginForm("Load_data", "Admin")) {
<div class="container container-fluid">
<br />
<div class="row">
<div class="col-lg-offset-1 col-lg-5">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-users" aria-hidden="true"></i>
</div>
#Html.DropDownListFor(m => m.user_email, ViewBag.user_email as IEnumerable<SelectListItem>, new { #class = "form-control",#onchange= "this.form.submit();" })
</div>
</div>
</div>
</div>
}
<div id="Details">
//Details of selected email id will be shown here
</div>
</div>
<div id="Delete" class="tab-pane">
</div>
<div id="menu3" class="tab-pane">
</div>
</div>
Basically you can't do that, because your page is refreshing. If you want that then you need to do it asynchronously. I mean you need to use #Ajax.BeginForm or jquery/ajax.
If you don't want to do it asynchronously, then there is a work around way.
So while calling to your action method after selecting an email from your Update tab, assign a value in a ViewBag.
For example, in your action method,
{
//Rest code
ViewBag.TabValue = "Update";
//Rest code
}
Now you can keep this value in a hidden field. For example, in your view,
<input type="hidden" value="#ViewBag.TabValue" id="myTab"/>
So now, in your script, you can check this value and set your tab, like,
<script>
if($('#myTab').val() == "Update")
{
$("#Update").focus(); //You can add a class as active so on...
}
</script>
Hope it helps :)

JQuery Multi-step form in asp.net mvc

I have a multistep form wizard that go through seven(7) steps.
image
Controllers:
private RegistrationEntities db = new RegistrationEntities();
public ActionResult Index()
{
return View();
}
View:
<div class="title_right">
<div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Go!</button>
</span>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Contractors <small>Pre-Registration</small></h2>
<ul class="nav navbar-right panel_toolbox">
<li>
<a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
</li>
<li class="dropdown">
<i class="fa fa-wrench"></i>
<ul class="dropdown-menu" role="menu">
<li>
Settings 1
</li>
<li>
Settings 2
</li>
</ul>
</li>
<li>
<a class="close-link"><i class="fa fa-close"></i></a>
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<p>Kindly Follow the Procedures for the Pre-Registration Process.</p>
<div id="wizard" class="form_wizard wizard_horizontal">
<ul class="wizard_steps">
<li>
<a href="#step-1">
<span class="step_no">1</span>
<span class="step_descr">
Step 1<br />
<small>Step 1: Ownership Confirmation</small>
</span>
</a>
</li>
<li>
<a href="#step-2">
<span class="step_no">2</span>
<span class="step_descr">
Step 2<br />
<small>Step 2: RC Number</small>
</span>
</a>
</li>
<li>
<a href="#step-3">
<span class="step_no">3</span>
<span class="step_descr">
Step 3<br />
<small>Step 3: Company Name</small>
</span>
</a>
</li>
<li>
<a href="#step-4">
<span class="step_no">4</span>
<span class="step_descr">
Step 4<br />
<small>Step 4: TIN Number/Company Details</small>
</span>
</a>
</li>
<li>
<a href="#step-5">
<span class="step_no">5</span>
<span class="step_descr">
Step 5<br />
<small>Step 5: Company's Email</small>
</span>
</a>
</li>
<li>
<a href="#step-6">
<span class="step_no">6</span>
<span class="step_descr">
Step 6<br />
<small>Step 6: Other Company Details</small>
</span>
</a>
</li>
<li>
<a href="#step-7">
<span class="step_no">7</span>
<span class="step_descr">
Step 7<br />
<small>Step 7: Captcha</small>
</span>
</a>
</li>
</ul>
<div id="step-1">
<form class="form-horizontal form-label-left">
<div class="form-group">
<div class="col-lg-12">
<div class="col-lg-3">
<div class="form-group">
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<div class="radio">
#Html.RadioButtonFor(m => m.OWNERSHIP_STRUCTURE, 1, new { #class = "DoPopup", id = "Foreign Company", value = "" }) Foreign Company
</div>
<div class="radio">
#Html.RadioButtonFor(m => m.OWNERSHIP_STRUCTURE, 2, new { #class = "DoPopup", id = "Foreign Owned Nigerian Company", value = "" }) Foreign Owned Nigerian Company
</div>
<div class="radio">
#Html.RadioButtonFor(m => m.OWNERSHIP_STRUCTURE, 3, new { #class = "DoPopup", id = "Nigerian Company", value = "" }) Nigerian Company
</div>
</div>
</div>
<div class="col-lg-3">
<div class="form-group">
</div>
</div>
</div>
</div>
</form>
</div>
<div id="step-2">
#*<h2 class="StepTitle">Step 2 Content</h2>*#
<form class="form-horizontal form-label-left">
<div class="col-lg-12">
<div class="form-group">
#Html.LabelFor(model => model.RC_NUMBER, new { #class = "col-lg-2 control-label" })
<div class="col-lg-9">
#Html.TextBoxFor(model => model.RC_NUMBER, new { #class = "form-control" })
#Html.ValidationMessageFor(model => model.RC_NUMBER)
</div>
</div>
</div>
</form>
</div>
<div id="step-3">
#*<h2 class="StepTitle">Step 3 Content</h2>*#
<form class="form-horizontal form-label-left">
<div class="form-group">
<div class="col-lg-12">
<div class="form-group">
#Html.LabelFor(model => model.COMPANY_NAME, new { #class = "col-lg-2 control-label" })
<div class="col-lg-9">
#Html.TextBoxFor(model => model.COMPANY_NAME, new { #class = "form-control" })
#Html.ValidationMessageFor(model => model.COMPANY_NAME)
</div>
</div>
</div>
</div>
</form>
</div>
<div id="step-5">
<form class="form-horizontal form-label-left">
<div class="col-lg-12">
<div class="form-group">
#Html.LabelFor(model => model.COMPANY_CONTACT_EMAIL, new { #class = "col-lg-2 control-label" })
<div class="col-lg-9">
#Html.TextBoxFor(model => model.COMPANY_CONTACT_EMAIL, new { #class = "form-control" })
#Html.ValidationMessageFor(model => model.COMPANY_CONTACT_EMAIL)
</div>
</div>
</div>
</form>
</div>
<div id="step-6">
<form class="form-horizontal form-label-left">
<div class="col-lg-12">
<div class="form-group">
<div class="col-lg-2">
Alternative E-mail
</div>
<div class="col-lg-9">
#Html.TextBoxFor(model => model.COMPANY_CONTACT_ALTERNATIVE_EMAIL, new { #class = "form-control" })
#Html.ValidationMessageFor(model => model.COMPANY_CONTACT_ALTERNATIVE_EMAIL)
</div>
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<div class="col-lg-2">
Website
</div>
<div class="col-lg-9">
#Html.TextBoxFor(model => model.WEBSITE, new { #class = "form-control" })
#Html.ValidationMessageFor(model => model.WEBSITE)
</div>
</div>
</div>
<h3>Login Details</h3>
<hr />
<div class="col-lg-12">
<div class="col-lg-1">
</div>
<div class="form-group">
<div class="col-lg-2">
Username
</div>
<div class="col-lg-8">
#*<i class="glyphicon glyphicon-user"></i>*#
<input class="form-control input-lg" name="MERGE0" id="email" type="email" placeholder="Email address" required>
</div>
</div>
<div class="col-lg-1">
</div>
</div>
<div class="col-lg-12">
<div class="col-lg-1">
</div>
<div class="form-group">
<div class="col-lg-2">
Password
</div>
<div class="col-lg-8">
#*<i class="glyphicon glyphicon-user"></i>*#
<input class="form-control input-lg" name="MERGE1" id="password" type="password" placeholder="Password" required>
</div>
</div>
<div class="col-lg-1">
</div>
</div>
</form>
</div>
<div id="step-7">
<form class="form-horizontal form-label-left">
<div class="col-lg-12">
<div class="col-lg-1">
</div>
<div class="form-group">
<div class="col-lg-10">
#Html.MathCaptcha()
#* #Html.Captcha(3)*#
<br />
<p class="Error"> #ViewBag.ErrMessage </p>
</div>
</div>
<div class="col-lg-1">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
}
<!-- jQuery Smart Wizard -->
<script>
$(document).ready(function () {
$('#wizard').smartWizard();
$('#wizard_verticle').smartWizard({
transitionEffect: 'slide'
});
$('.buttonNext').addClass('btn btn-success');
$('.buttonPrevious').addClass('btn btn-primary');
$('.buttonFinish').addClass('btn btn-default');
});
</script>
<!-- /jQuery Smart Wizard -->
The questions are:
How I I validate each step to make sure values are entered befor going to the next step
After completing the 7 steps, how do I valid that the values are entered properly before it saves.
After completing the 7th step, I clicked on the Finish button, no record was saved into the CONTRACTORS table
In step2, when RC_NUMBER is entered, it should check if it already exists. It should use it to populate COMPANY_NAME in step3, but if it doesnt exist, it should allow the user to enter COMPANY_NAME in step3
After completing the whole steps and Finish button is clicked, it should redirect to welcome model using ActionResult Welcome
Please check the answers to your questions below:
1.) jQuery SmartWizard allows us to add onLeaveStep:leaveAStepCallback field while declaring. leaveAStepCallback is the function that will be called when you click on the next button. You can implement your validation logic in this function. Please go through this URL to get the complete idea.
2.) jQuery SmartWizard also allows us to add onFinish:onFinishCallback field while declaring. In this case onFinishCallback function will be called after all the steps are completed. You can check here if all the inputs are valid and then submit the form. You must have got the idea if you had gone through the link in answer 1.
3.) You need to further elaborate why the details were not saved in DB? Is your controller action getting called? If yes, check your DB save logic to further find the issue as this is not the issue of SmartWizard.
4.) As I mentioned in the step 1 that bind a callback function to be called when next button is clicked. In this function, you can get the step number by using context.fromStep. After that you can make an ajax call to server to check if the value already exist. Implement your custom logic as required.
5.) If you are submitting form using $('form').submit(), you can redirect custom view from the controller after succesful operation. If you are making an ajax call, redirect to another controller in sucess function of ajax call.

How can i prevent page refresh (reload) while pressing login button in asp.net mvc identity?

So folks, i just created a _Login partial instead of Login view and rendered that partial view in my _Layout. The partial view is shown in a Modal, until yet everything seems OK! But whenever i just click the Login (Sign In) button the page reloads and nothing happens although i expect an error like the E-mail field cannot be empty or the user does not exist but surprisingly nothing happens and the page refreshes.
Here is the code for the _Login partial.
#model Hire.af.WebUI.Models.LoginViewModel
<div class="modal-body">
<!--Social Media Login Links-->
<div class="form-group row login-socical">
<div class="col-sm-9 col-sm-offset-3">
<div class="button_socical fb">
<i class="fa fa-facebook-square"> </i>
<em class="fa-facebook-square">Login with Facebook</em>
</div>
<div class="button_socical gg">
<i class="fa fa-google-plus"> </i>
<em class="fa-google-plus">Login with Google</em>
</div>
<div class="button_socical linkedin">
<i class="fa fa-linkedin-square"> </i>
<em class="fa-linkedin-square">Login with LinkedIn</em>
</div>
</div>
</div>
<!--Login Form-->
<form class="noo-ajax-login-form form-horizontal">
#using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { #class = "form-horizontal", role = "form" }))
{
#Html.AntiForgeryToken()
<hr />
#Html.ValidationSummary(true, "", new { #class = "col-sm-3" })
<div class="form-group row">
#Html.LabelFor(m => m.Email, new { #class = "col-sm-3 control-label" })
<div class="col-sm-9">
#Html.TextBoxFor(m => m.Email, new { #class = "log form-control", #placeholder="Email OR Username" })
#Html.ValidationMessageFor(m => m.Email, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group row">
#Html.LabelFor(m => m.Password, new { #class = "col-sm-3 control-label" })
<div class="col-sm-9">
#Html.PasswordFor(m => m.Password, new { #class = "pwd form-control", #placeholder="Password" })
#Html.ValidationMessageFor(m => m.Password, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<div class="checkbox">
#Html.CheckBoxFor(m => m.RememberMe)
#Html.LabelFor(m => m.RememberMe)
</div>
</div>
</div>
<!--Remember Me Checkbox-->
<div class="form-actions form-group text-center">
<button type="submit" class="btn btn-primary">Sign In</button>
<div class="login-form-links">
<span><i class="fa fa-question-circle"></i> Forgot Password?</span>
<span>
Don't have an account yet?
<a href="#" class="member-register-link" data-rel="registerModal">
#Html.ActionLink("Register Now", "Register") <i class="fa fa-long-arrow-right"></i>
</a>
</span>
</div>
</div>
#* Enable this once you have account confirmation enabled for password reset functionality
<p>
#Html.ActionLink("Forgot your password?", "ForgotPassword")
</p>*#
}
</form>
</div>
and below is how i rendered this partial in my _Layout.
<div class="memberModalLogin modal fade" id="userloginModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-member">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">Login</h4>
</div>
<!--Login Partial Goes Here-->
#Html.Partial("_Login")
</div>
</div>
</div>
Any help would be appreciated.
You have nested forms which is invalid html and not supported. Remove the outer form from your partial view
<form class="noo-ajax-login-form form-horizontal"> // remove this and its closing tag
#using (Html.BeginForm(....

Resources