@model CardNumbers.Objects.Client @{ ViewBag.Title = "Edit Client"; Layout = "~/Views/Shared/_PopupLayout.cshtml"; } @Html.Partial("_ClientForm", Model) @section Scripts { @Scripts.Render("~/bundles/jqueryval") <script src="@Url.Content("~/Scripts/Clients.js")" type="text/javascript" ></script> }as you can see, it is supposed to use a different layout.
// GET: /Client/Edit/5 public ActionResult Edit(int id) { var client = Db.GetClientById(id); return View(client); }and also, more importantly, I am still struggling on trying to make the modal form work for the Edit button. With some help in stackoverflow I got the form show and be able to close and resize using this code:
var $dlg = $("#sform").dialog({ autoOpen: false, show: "blind", closeOnEscape: true, resizable: true, width: 1200, height: 750, minHeight: 600, minWidth: 950 }); function RunModalDialog(title, url) { if (title) $dlg.dialog("option", {"title": title }); if (url) $dlg.load(url, function () { $dlg.dialog("option", {"title": title }).dialog("open"); }); else $dlg.dialog("open"); } function add(com, grid){ RunModalDialog("Create New Client"); clearForm(); $('#fntype').val('Add'); } function edit(com, grid) { $('.trSelected', grid).each(function () { var id = $(this).attr('id'); id = id.substring(id.lastIndexOf('row') + 3); currentId = id; $('#fntype').val('Edit'); var ClientName; ClientName =$('.trSelected td:eq(2)').text(); var url = '/Client/Edit/' + id; RunModalDialog("Edit Client: " + ClientName, url); }); }However, now, right after the Edit view finished loading, the Client method of the controller gets hit again (the Client is the main view which invokes that modal dialog). I am not sure why this is happening and how can I prevent it. It is not happening for the Add button.