While writing codes in your project you need to interact with the JQuery for making your application execution smooth and efficient.
So for doing that, we need to use different kind of attributes that is used for getting the current value of the controls.
So get is one of the properties that we use for making the request from one view to the other view.
$(".lnkEdit").live("click", function (e) {
var id = $(this).attr('id');
url = '@Url.Content("~/Home/_Edit")/' + id;
$("#dialog-edit").dialog('open');
$.get(url,function (result) {
alert(result);
$("#dialog-edit").html(result);
});
Making the use of the property we have made the use of partial view named _Edit that is being invoked while edit is being done.
$("#dialog-edit").dialog({
title: 'Create User',
autoOpen: false,
resizable: false,
width: 400,
show: { effect: 'drop', direction: "up" },
modal: true,
draggable: true,
open: function (event, ui) {
$(".ui-dialog-titlebar-close").hide();
$(this).load(url);
}
});
This is the dialog that we have made to display for the editing of data.
[HttpGet]
public ActionResult _Edit(int id = 0)
{
EmpMod = new EmployeeModel();
EmpMod.EmpId = id;
EmpRep = new EmployeeRepository();
EmpMod = EmpRep.EditDetails(EmpMod);
return PartialView("_Edit", EmpMod);
}
0 Comment(s)