I am developing an application in MVC using Smart Admin in which I use data annotations for validation purpose. My code is:
public class EmployeeDTO
{
[Key]
public int Id { get; set; }
[Required(ErrorMessage = "Name is required")]
[StringLength(50, ErrorMessage = "Name can accept maximum 50 characters.")]
[RegularExpression("^([a-zA-Z]{1}[a-zA-Z '-.(-,)-/&]*)$", ErrorMessage = "Please enter valid name.")]
public string Name { get; set; }
}
and my view is
<script src="~/SmartAdmin/js/libs/jquery-2.0.2.min.js"></script>
<script src="#Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
#model HBSeworld.Admin.DTO.EmployeeDTO
#{
ViewBag.Title = "Create";
}
<section class="jarviswidget" id="wid-id-1" data-widget-editbutton="false" data-widget-custombutton="false">
<header>
<span class="widget-icon"><i class="fa fa-user"></i></span>
<h2>Create Employee</h2>
</header>
<div>
<div class="jarviswidget-editbox">
</div>
<section class="widget-body no-padding">
#using (Html.BeginForm("Create", "Employee", FormMethod.Post, new { #id = "order-form", enctype = "multipart/form-data", #class = "smart-form" }))
{
#Html.ValidationSummary(true)
<fieldset>
<div class="row">
<section class="label col col-2" style="text-align: right">
#Html.LabelFor(model => model.Name)
</section>
<section class="col col-4">
<label class="input">
<i class="icon-append fa fa-user"></i>
#Html.TextBoxFor(model => model.Name, null, new { #placeholder = "Enter Name" })
#Html.ValidationMessageFor(model => model.Name)
</label>
</section>
</div>
</fieldset>
<div class="pull-right" style="margin-right: 5px; margin-bottom: 10px;">
<input type="submit" id="create" value="Create" class="btn btn-primary" style="height: 25px; width: 45px;" />
<input type="button" style="height:25px; width:45px;" value="Cancel" class="btn btn-default" onclick="window.location.href='#Url.Action("index") '"/>
</div>
}
</section>
</div>
</section>
Now, my question is that, when I click on Create button, data annotation message is displayed properly but at the same time the control goes to controller, instead it should be on same view and have to display data annotation message. How to prevent this? Any solution?
Related
i have trouble with my code, ajax beginForm does not make reference with the controller event, i have all the library.
the view :
#using MyWebsite.Models
#model UsersCLS
#{
ViewBag.Title = "Index";
}
<h1 style="text-align:center;">My Web Site</h1>
<section class="vh-100">
<div class="container py-5 h-100">
<div class="row d-flex align-items-center justify-content-center h-100">
<div class="col-md-8 col-lg-7 col-xl-6">
<img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-login-form/draw2.svg" class="img-fluid" alt="Phone image">
</div>
<div class="col-md-7 col-lg-5 col-xl-5 offset-xl-1">
<form>
<!-- Email input -->
<div class="form-outline mb-4">
<input type="email" id="form1Example13" class="form-control form-control-lg" />
<label class="form-label" for="form1Example13">Email address</label>
</div>
<!-- Password input -->
<div class="form-outline mb-4">
<input type="password" id="form1Example23" class="form-control form-control-lg" />
<label class="form-label" for="form1Example23">Password</label>
</div>
<div>
<!-- Checkbox -->
<div class="form-check">
<input class="form-check-input"
type="checkbox"
value=""
id="form1Example3"
checked />
<label class="form-check-label" for="form1Example3"> Remember me </label>
</div>
</div>
<div>
Forgot password?
</div>
<!-- Submit button -->
<button type="submit" class="btn btn-primary btn-lg btn-block">Sign in</button>
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg btn-block" data-bs-toggle="modal" data-bs-target="#exampleModal">
Check in
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
</div>
#using (Ajax.BeginForm("Add", "Login", null, new AjaxOptions
{
HttpMethod = "POST",
OnSuccess = "Create",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "error"
}))
{
<div>
#Html.Label("Name")
#Html.TextBox("name", null, new { #class = "form-control" })
</div>
<div>
#Html.Label("LastName")
#Html.TextBox("lastName", null, new { #class = "form-control" })
</div>
<div>
#Html.Label("Email")
#Html.TextBox("email", null, new { #class = "form-control", #type = "email" })
</div>
<div>
#Html.Label("UserName")
#Html.TextBox("userName", null, new { #class = "form-control" })
</div>
<div>
#Html.Label("Password")
#Html.Password("password", null, new { #class = "form-control" })
</div>
<button type="button" id="btnClose" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save changes </button>
}
<div id="error">
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</section>
<script src="~/Scripts/jquery-3.6.0.min.js"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="~/Scripts/bootstrap.js"></script>
this is the Model:
public class UsersCLS
{
[Display(Name ="Id")]
public int id { get; set; }
[Display(Name = "User")]
public string userName { get; set; }
[Display(Name = "Password")]
public string password { get; set; }
[Display(Name = "Name")]
public string name { get; set; }
[Display(Name = "Last Name")]
public string lastName { get; set; }
[Display(Name = "Email")]
public string email { get; set; }
}
And the Controller :
public ActionResult Index()
{
return View();
}
public string Add(UsersCLS usersCLS)
{
string answer = "";
if (!ModelState.IsValid)
{
}
else
{
using (var bd = new MyWebsiteEntities())
{
int count = 0;
using (var transc = new TransactionScope())
{
count = bd.Users.Where(p => p.UserName.Equals(usersCLS.userName)).Count();
if (count > 0)
{
answer += "<ul class='list-group'>";
answer += "<li></li>";
answer += "</ul>";
}
else
{
Users users = new Users();
users.UserName = usersCLS.userName;
SHA256Managed sha = new SHA256Managed();
byte[] bypass = Encoding.Default.GetBytes(usersCLS.password);
byte[] bycryptoPass = sha.ComputeHash(bypass);
string cryptoPass = BitConverter.ToString(bycryptoPass).Replace("-", "");
users.Password = cryptoPass;
users.Name = usersCLS.name;
users.UserName = usersCLS.userName;
users.LastName = usersCLS.lastName;
users.Email = usersCLS.email;
users.Enabled = true;
bd.Users.Add(users);
answer = bd.SaveChanges().ToString();
if (answer == "0")
{
answer = "";
}
transc.Complete();
}
}
}
}
return answer;
}
}
But (Ajax.BeginForm("Add", "Login")
does not make reference with controller event Please help, sorry for my bad english have a nice Day and thank you.
In my ASP.NET MVC application in the view, I'm calling another view that is not related to the current model. There I need some help that how to call the different model views from another view.
#model Asp_PASMVC.Models.VehicleService
#using Asp_PASMVC.Infrastructure
#{
ViewBag.Title = "View";
Layout = "~/Views/Shared/_Layout.cshtml";
List<SelectListItem> CompanyList = (List<SelectListItem>)TempData.Peek("ComapnyList");
List<SelectListItem> ReqTypes = (List<SelectListItem>)TempData.Peek("RequestTyleList");
List<SelectListItem> Employees = (List<SelectListItem>)TempData.Peek("EmployeeList");
List<SelectListItem> Location = (List<SelectListItem>)TempData.Peek("LocationList");
Asp_PASMVC.Models.AppRequest RequestDetails = (Asp_PASMVC.Models.AppRequest)TempData.Peek("RequestDetails");
}
#{
Html.RenderPartial("_MainRequestView", RequestDetails);
}
#using (Html.BeginForm("WorkshopUpdate", "VehicleService", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
#Html.HiddenFor(model => model.Req_Id)
#Html.AntiForgeryToken()
if (Model != null && Model.VehicleServiceApproveDetails != null)
{
foreach (Asp_PASMVC.Models.VehicleServiceApproveDetails Emp in Model.VehicleServiceApproveDetails)
{
Html.RenderPartial("_WorkshopUpdate", Emp);
}
}
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<!-- Default box -->
<div class="card">
<div class="card-header">
<h3 class="card-title">Approver Details</h3>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
<i class="fas fa-minus"></i>
</button>
</div>
</div>
<div class="card-body">
<div>
<fieldset id="pnlApproverList" style="display:none">
<legend><h5>To whom you want to send this request for approval ? </h5> </legend>
<br />
<ul id="RequApprover" style="list-style-type: none">
#if (Model != null && Model.ApprovalPartyList != null)
{
foreach (Asp_PASMVC.Models.ApprovalParty Emp in Model.ApprovalPartyList)
{
Html.RenderPartial("_ApprovalView", Emp);
}
}
</ul>
<button type="button" id="addAnotherApprover" class="btn btn-success" href="#" onclick="this.style.display = 'none';">Add</button>
<script type="text/javascript">
$(function () {
// $("#movieEditor").sortable();
$("#addAnotherApprover").click(function () {
$.get('/VehicleService/AddApproverToReq', function (template) {
$("#RequApprover").append(template);
});
});
});
</script>
<br />
</fieldset>
</div>
</div>
<!-- /.card-footer-->
</div>
<!-- /.card -->
</div>
</div>
</div>
</section>
<div class="card-footer">
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Update and Sent" class="btn btn-success" />
</div>
</div>
</div>
}
<p>
#Html.ActionLink("Back to List", "Index")
</p>
So likewise here the model is VehicleService. So within that view, I want to call another view that is not within the vehicleservice model.
But I cannot load that partial view within this view. Is there any way to do this?
#model Asp_PASMVC.Models.ApprovalParty
#using Asp_PASMVC.Infrastructure
#{
string UserLvel = TempData.Peek("UserLevelClaims").ToString();
}
<li style="padding-bottom:15px">
#using (Html.BeginCollectionItem("ApprovalPartyList"))
{
<div class="row">
<div class="col-md-5 col-sm-5">
<div class="form-group">
<label>
#Html.RadioButtonFor(m => m.Approve_Type, false)
<span class="radiomargin">For Manager</span>
</label>
<br />
#if (UserLvel != "1")
{
<label>
#Html.RadioButtonFor(m => m.Approve_Type, true)
<span class="radiomargin">For Top Manager </span>
</label>
#Html.ValidationMessageFor(model => model.Approve_Type, "", new { #class = "text-danger" })
}
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-md-6 col-sm-6">
<div class="form-group row">
Select the Approver
<div class="col-sm-8">
#Html.DropDownListFor(model => model.Approver_Id, new List<SelectListItem>(), new { #id = "ddlEmployees", #class = "js-dropdown" })
#Html.ValidationMessageFor(model => model.Approver_Id, "", new { #class = "text-danger" })
</div>
</div>
</div>
</div>
}
</li>
Create a ViewModel which can have both Properties and pass that viewmodel to View
Model class:
public class VehicleSerivceViewModel
{
public VehicleService VehicleService { get; set; }
public ApprovalParty ApprovalParty { get; set; }
}
In View :
#model Asp_PASMVC.Models.VehicleServiceVewModel
pass ViewModel to partial as below:
#Model.ApprovalParty
I'm working on a use case in my animal shelter web application where customers are able to register one or more animals at the same time. Ideally I'd like a button on the bottom left that generates another instance of the same form when clicked, so that multiple animal registrations can be saved to the database at once.
NewAnimalRegistration.cshtml:
#model NewAnimalRegistrationViewModel
<html>
<head>
<title>Register an animal</title>
<link rel="stylesheet" href="~/css/style.css"/>
</head>
<body>
<div class="container py-5">
<div class=" row">
<div class="col-md-10" mx-auto>
<div asp-validation-summary="All"></div>
<h1>Animal registration</h1>
<p>
We are happy to hear that you are interested in placing your animal in our shelter. Please fill in the fields below and our system will
check if there is room for your animal.
</p>
<form asp-action="RegistrationForm" method="post">
<div class="form-group row mt-5">
<div class="col-sm-6">
<label asp-for="Name">Name</label>
<input asp-for="Name" class="form-control"/>
</div>
</div>
<div class="form-group row mt-5">
<div class="col-sm-4">
<label asp-for="Gender" class="mr-3">Gender</label>
<select class="form-group" asp-for="Gender" asp-items="#ViewBag.Genders"></select>
</div>
<div class="col-sm-4">
<label asp-for="Type" class="mr-3">Animal type</label>
<select class="form-group" asp-for="Type" asp-items="#ViewBag.AnimalTypes"></select>
</div>
<div class="col-sm-4">
<label>Neutered</label>
<div class="form-check">
<input asp-for="IsNeutered" class="form-check-input" type="radio" value="true">
<label class="form-check-label" asp-for="IsNeutered">
Yes
</label>
</div>
<div class="form-check">
<input asp-for="IsNeutered" class="form-check-input" type="radio" value="false">
<label class="form-check-label" asp-for="IsNeutered">
No
</label>
</div>
</div>
</div>
<div class="form-group mt-5">
<label asp-for="Reason">Why are you deciding to put this animal up for adoption?</label>
<textarea class="form-control" asp-for="Reason" rows="6"></textarea>
</div>
<div class="float-right">
<a asp-controller="Home" asp-action="Index" class="btn btn-primary px-4">Cancel</a>
<button class="btn btn-primary px-4">Save</button>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
Is there a way to do this in .NET Core MVC? If yes, will I simply receive a list of all animal registrations through which I can simply loop and add them all to the database?
I made a demo based on your description, you can refer to it:
Model:
public class NewAnimalRegistrationViewModel
{
public int Id { get; set; }
public string Name { get; set; }
public string Gender { get; set; }
public string Type { get; set; }
public bool IsNeutered { get; set; }
public string Reason { get; set; }
}
Index.cshtml:
#model NewAnimalRegistrationViewModel
<html>
<head>
<title>Register an animal</title>
</head>
<body>
<div class="container py-5">
<div class=" row">
<div class="col-md-10" mx-auto>
<div asp-validation-summary="All"></div>
<h1>Animal registration</h1>
<p>
We are happy to hear that you are interested in placing your animal in our shelter. Please fill in the fields below and our system will
check if there is room for your animal.
</p>
<form asp-action="RegistrationForm" method="post">
<div class="float-right">
<a asp-controller="Home" asp-action="Index" class="btn btn-primary px-4">Cancel</a>
<button class="btn btn-primary px-4">Save</button>
</div>
</form>
<a id="add" href='#' class="text-danger">register another animal</a>
</div>
</div>
</div>
</body>
</html>
#section scripts{
<script>
var count = 0;
$(function () {
var actionUrl = "/Home/AddRegistrationForm?count=" + count;
$.get(actionUrl).done(function (data) {
$('body').find('.float-right').before(data);
});
})
$("#add").on("click", function (e) {
e.preventDefault();
count++;
var actionUrl = "/Home/AddRegistrationForm?count=" + count;
$.get(actionUrl).done(function (data) {
$('body').find('.float-right').before(data);
});
})
</script>
}
_RegisterPartial.cshtml:
#model NewAnimalRegistrationViewModel
#{
int i = ViewBag.Count;
}
<h3>Anaimal #i</h3>
<div class="form-group row mt-5">
<div class="col-sm-6">
<label asp-for="Name">Name</label>
<input asp-for="Name" name="[#i].Name" class="form-control" />
</div>
</div>
<div class="form-group row mt-5">
<div class="col-sm-4">
<label asp-for="Gender" class="mr-3">Gender</label>
<select class="form-group" asp-for="Gender" name="[#i].Gender" asp-items="#ViewBag.Genders"></select>
</div>
<div class="col-sm-4">
<label asp-for="Type" class="mr-3">Animal type</label>
<select class="form-group" asp-for="Type" name="[#i].Type" asp-items="#ViewBag.AnimalTypes"></select>
</div>
<div class="col-sm-4">
<label>Neutered</label>
<div class="form-check">
<input asp-for="IsNeutered" name="[#i].IsNeutered" class="form-check-input" type="radio" value="true">
<label class="form-check-label" asp-for="IsNeutered">
Yes
</label>
</div>
<div class="form-check">
<input asp-for="IsNeutered" name="[#i].IsNeutered" class="form-check-input" type="radio" value="false">
<label class="form-check-label" asp-for="IsNeutered">
No
</label>
</div>
</div>
</div>
<div class="form-group mt-5">
<label asp-for="Reason">Why are you deciding to put this animal up for adoption?</label>
<textarea class="form-control" asp-for="Reason" name="[#i].Reason" rows="6"></textarea>
</div>
Controller:
public IActionResult Index()
{
return View();
}
[HttpGet]
public IActionResult AddRegistrationForm(int count)
{
ViewBag.Count = count;
ViewBag.Genders = new List<SelectListItem>
{
new SelectListItem{ Text = "Female", Value="Female"},
new SelectListItem{ Text = "Male", Value="Male"}
};
ViewBag.AnimalTypes = new List<SelectListItem>
{
new SelectListItem{ Text = "Cat", Value="Cat"},
new SelectListItem{ Text = "Dog", Value="Dog"}
};
return PartialView("_RegisterPartial");
}
[HttpPost]
public IActionResult RegistrationForm(List<NewAnimalRegistrationViewModel> model)
{
return View();
}
Result:
There are some similar topics in forums, but there isn't any good answer. First question is that is it possible to pass httppostedfilebase to controller, when using modal popup?
When I am using regular model and view, then everything is working well, but as soon I make this view as partialview, then everything except file is passing to controller. File is getting null value.
List View where modalpopup is excecuting:
<button style="cursor:pointer" type="submit" class="fluent-big-button" onclick="ShowModal('#Url.Action("Create", "Device")')" >
Modal Popup View:
#using (Html.BeginForm("Create", "Device", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
#Html.AntiForgeryToken()
<div class="modal-body">
<div class="form-horizontal">
<fieldset>
<legend>#Resources.Insert_New_Device</legend>
<div class="grid" style="margin: 0px auto">
<div class="row" style="margin: 0px auto">
<div class="span10">
<div class="row" style="margin: 0px auto">
<div style="white-space:nowrap" class="span2 readable-text"><label>#Resources.Device_No:</label> </div>
<div class="span3">
<div class="input-control text" data-role="input-control">
#Html.TextBoxFor(m => Model.No, new { required = "required", autofocus = "autofocus", #tabindex="1"})
#Html.ValidationMessageFor(m => Model.No)
<button tabindex="-1" class="btn-clear" type="button"></button>
</div>
</div>
<div style="white-space:nowrap" class="span2 readable-text"><label>Tootja:</label> </div>
<div class="span3">
<div class="input-control text" data-role="input-control">
#Html.TextBoxFor(m => Model.Manufacturer_Name, new { autofocus = "autofocus", #tabindex="2"})
#Html.ValidationMessageFor(m => Model.Manufacturer_Name)
<button tabindex="-1" class="btn-clear" type="button"></button>
</div>
</div>
</div>
<div class="row" style="margin: 0px auto">
<div style="white-space:nowrap" class="span2 readable-text"><label>Pilt:</label> </div>
<div class="span3">
<div class="fallback">
<input type="file" name="DeviceImage" id="DeviceImage" />
</div>
</div>
</div>
</div>
<div class="row" style="margin: 0px auto">
<div class="span10">#Html.ValidationMessage("CustomError")</div>
</div>
</div>
</div>
</fieldset>
</div>
</div>
<div class="modal-footer">
<div class="grid" style="margin: 0px auto">
<div class="row" style="margin: 0px auto">
<div class="span4"></div>
<div class="span3">
<button class="button large span3" data-dismiss="modal">Cancel</button>
</div>
<div class="span3">
<input class="large span3 success" type="submit" value="Ok" />
</div>
</div>
</div>
</div>
}
Controller:
public ActionResult Create()
{
ViewBag.exsistingDevices = GetExsistingDevices();
return PartialView("_Create");
}
[HttpPost]
[ValidateAntiForgeryToken]
[Authorize(Roles = "Admin, Super")]
public async Task<ActionResult> Create(Device device, HttpPostedFileBase DeviceImage)
{
try
{
if (ModelState.IsValid)
{
SPDBContext db = new SPDBContext();
device.Last_Action_Date = DateTime.Now;
// Insert image
if (DeviceImage != null)
{
if (DeviceImage.ContentLength > (2 * 1024 * 1024) && DeviceImage.ContentLength < 1)
{
ModelState.AddModelError("CustomError", "File size must be less than 2 MB");
}
var contentType = DeviceImage.ContentType;
device.Image = new byte[DeviceImage.ContentLength];
DeviceImage.InputStream.Read(device.Image, 0, DeviceImage.ContentLength);
}
db.Devices.Add(device);
await db.SaveChangesAsync();
return Json(new { success = true });
}
}
catch (Exception e)
{
ModelState.AddModelError("CustomError", String.Format("{0}: {1}",Resources.Resources.Insert_Failed, e.Message));
}
return PartialView("_Create", device);
}
Model:
[NotMapped]
public HttpPostedFileBase DeviceImage { get; set; }
public byte[] Image { get; set; }
I have 2 two pages.
First page
#model IncidentsDB.UI.Web.ViewModels.Account.LogOnModel
#{
ViewBag.Title = "Вход в систему";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="#Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div class="headerLabel">
<h3>Вход в систему</h3>
</div>
#using (Html.BeginForm("Register", "Account", FormMethod.Get, new { id = "searchForm" }))
{
<div class="createUserDiv">
<input type="submit" class="lightGreenGradientBtn" id="createUserBtn" value="Добавить нового пользователя" />
</div>
}
#using (Html.BeginForm()) {
<div class="loginDataDiv">
<div class="leftItemDiv labelDiv" style="padding-left: 45px">
#Html.LabelFor(m => m.UserName)
</div>
<div class="editor-field rightItemDiv">
#Html.TextBoxFor(m => m.UserName)
</div>
<div class="loginErrorDiv labelDiv">
#Html.ValidationMessageFor(m => m.UserName)
</div>
<div class="leftItemDiv labelDiv" style="padding-left: 45px">
#Html.LabelFor(m => m.Password)
</div>
<div class="editor-field rightItemDiv noWrap">
#Html.TextBoxFor(m => m.Password)
</div>
<div class="rememberPswdDivCollapse" id="rememberPswdDiv">
#Html.ActionLink("Вспомнить пароль", "RestorePassword","Account", new { #class = "rememberPswdLink" })
</div>
<div class="loginErrorDiv">
#Html.ValidationMessageFor(m => m.Password)
</div>
<div class="clearStyles rightItemDiv">
<input type="submit" class="greenGradientBtn" id="loginBtn" value="Войти" />
</div>
</div>
}
and second page
#model IncidentsDB.UI.Web.ViewModels.Account.LogOnModel
#{
ViewBag.Title = "Вход в систему";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="#Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
#using (Html.BeginForm())
{
<div class="restorePswdDivVisible">
<p>
Введите адрес электронной почты, <br />
который вы указывали при регистрации:
</p>
<div class="editor-label">
#Html.LabelFor(m => m.UserName)
</div>
<div class="editor-field noWrap">
#Html.TextBoxFor(m => m.UserName)
#Html.ValidationMessageFor(m => m.UserName)
</div>
<div class="loginErrorDiv noWrap" style="width: 150px">
</div>
<div>
<input type="submit" class="lightGreenGradientBtn restorePswdBtn" id="restorePswdBtn" value="Восстановить" style="margin-left: 150px" />
</div>
</div>
}
also I have model class which is general for two pages
namespace IncidentsDB.UI.Web.ViewModels.Account
{
public class LogOnModel
{
[Required(ErrorMessage="Укажите логин")]
[Display(Name = "NicName", ResourceType = typeof(PersonalRes))]
public string UserName { get; set; }
[Required(ErrorMessage = "Укажите пароль")]
[DataType(DataType.Password)]
[Display(Name = "Password", ResourceType = typeof(PersonalRes))]
public string Password { get; set; }
[Required(ErrorMessage = "Укажите e-mail")]
[DataType(DataType.EmailAddress)]
[Display(Name = "Email", ResourceType = typeof(PersonalRes))]
public string Email
{
get;
set;
}
[Display(Name = "Rememberme", ResourceType = typeof(PersonalRes))]
public bool RememberMe { get; set; }
}
}
so this code works fine in firefox and chrome, but doesn't in ie!
why?
thanks in advance!