how to do mvc server side validations in jquery popup
iam using mvc,here am populating my create view as popup,iam able to get
the validations which i gave in the model,but validatons like 'NAME exists
or not' written in controller side are not performing in the popup and
they are showing by closing the popup.
The controller side am using the following code to check whether login
name exists or not
if (db.login.Count(l => l.Name== loginname_create) > 0)
{
ModelState.AddModelError("loginname", "name already exists");
}
the jquery popup dialog code is
$("#dialog").click(function (e) {
e.preventDefault();
var url = $(this).attr('href');
$("#dialog-create").dialog({
height:300,
width: 400,
show: { effect: 'drop', direction: "up" },
modal: true,
open: function (event, ui) {
$(this).load(url);
//$.validate.unobtrusive.parse("myform");
}, close: function (event, ui) {
$(this).dialog('close');
}
});
$("#dialog-create").dialog('open'); return false;
});
i want to populate the validations which i gave in the controller to be
shown in the popup dialog.
No comments:
Post a Comment