This question is locked. New answers and comments are not allowed.
Hi,
I have a fairly simple grid (version 2011.2.712.340) with ajax binding. The grid has editing set to popup. Everything was working fine till today. The "Add New Record" popup or the "Edit" popup, once opened, does not close with the "Insert" or "Update" button. The data does get saved as required. It is just that the popup remains open and does not close.
Here is the Model:
Here is the controller:
Here is the Editor Template:
Here is the View to display the grid:
<div class="grid">
And here is the helper method being used to create the grid:
I have seen a thread similar to my issue: http://www.telerik.com/community/forums/aspnet-mvc/grid/update-button-on-not-closing-popup.aspx
But it talks about updating to a version which is older than one that I use.
Any help is appreciated.
Thanks.
Subhendu.
I have a fairly simple grid (version 2011.2.712.340) with ajax binding. The grid has editing set to popup. Everything was working fine till today. The "Add New Record" popup or the "Edit" popup, once opened, does not close with the "Insert" or "Update" button. The data does get saved as required. It is just that the popup remains open and does not close.
Here is the Model:
public class DispatcherRequestDetails_Receiving { [Key] [DisplayName("Id")] public int DispatcherRequestDetails_Receiving_ID { get; set; } [UIHint("DispatcherRequestDropDownList")] public DispatcherRequest DispatcherRequest { get; set; } public int Request_No { get; set; } [StringLength(45, ErrorMessage = "Maximum length is 45")] public string RequestType { get; set; } [StringLength(45, ErrorMessage = "Maximum length is 45")] public string RequestStatus { get; set; } [UIHint("PartyMasterDropDownList")] public PartyMaster Party { get; set; } [UIHint("AddressBookDropDownList")] public AddressBook Location { get; set; } [StringLength(45, ErrorMessage = "Maximum length is 45")] public string Bin_No { get; set; } [StringLength(45, ErrorMessage = "Maximum length is 45")] public string Order_No { get; set; } public DateTime? Time { get; set; } [HiddenInput(DisplayValue = false)] [StringLength(45, ErrorMessage = "Maximum length is 45")] public string Unique_ID { get; set; } [HiddenInput(DisplayValue = false)] [StringLength(45, ErrorMessage = "Maximum length is 45")] public string Created_By { get; set; } [HiddenInput(DisplayValue = false)] public DateTime? Create_Date { get; set; } [HiddenInput(DisplayValue = false)] [StringLength(45, ErrorMessage = "Maximum length is 45")] public string Updated_By { get; set; } [HiddenInput(DisplayValue = false)] public DateTime? Last_Update_Date { get; set; } }Here is the controller:
[HttpPost] [GridAction(EnableCustomBinding = true)] public override ActionResult _Insert(DispatcherRequestDetails_Receiving data, GridCommand command) { if (Session["DispatcherRequestDetails_Receiving_Collection"] == null) Session["DispatcherRequestDetails_Receiving_Collection"] = new List<DispatcherRequestDetails_Receiving>(); List<DispatcherRequestDetails_Receiving> lstDispatcherRequestDetails_Receiving = (List<DispatcherRequestDetails_Receiving>)Session["DispatcherRequestDetails_Receiving_Collection"]; lstDispatcherRequestDetails_Receiving.Add(data); return Display(command); } protected override ActionResult Display(Telerik.Web.Mvc.GridCommand command) { if (Session["DispatcherRequestDetails_Receiving_Collection"] == null) Session["DispatcherRequestDetails_Receiving_Collection"] = new List<DispatcherRequestDetails_Receiving>(); List<DispatcherRequestDetails_Receiving> lstDispatcherRequestDetails_Receiving = (List<DispatcherRequestDetails_Receiving>)Session["DispatcherRequestDetails_Receiving_Collection"];
int totalRows = lstDispatcherRequestDetails_Receiving.Count; IEnumerable<DispatcherRequestDetails_Receiving> resultList = lstDispatcherRequestDetails_Receiving; return View(new GridModel { Data = resultList, Total = totalRows }); }Here is the Editor Template:
@model DispatcherRequestDetails_Receiving<br><div class="editor"><br> <br /><br> @Html.LabelFor(o => o.DispatcherRequestDetails_Receiving_ID)<br> @Html.EditorFor(o => o.DispatcherRequestDetails_Receiving_ID)<br> <br /><br> @Html.LabelFor(o => o.DispatcherRequest)<br> @Html.EditorFor(o => o.DispatcherRequest)<br> <br /><br> @Html.LabelFor(o => o.Request_No)<br> @Html.EditorFor(o => o.Request_No)<br> <br /><br> @Html.LabelFor(o => o.RequestType)<br> @Html.EditorFor(o => o.RequestType)<br> <br /><br> @Html.LabelFor(o => o.RequestStatus)<br> @Html.EditorFor(o => o.RequestStatus)<br> <br /><br> @Html.LabelFor(o => o.Party)<br> @Html.EditorFor(o => o.Party)<br> <br /><br> @Html.LabelFor(o => o.Location)<br> @Html.EditorFor(o => o.Location)<br> <br /><br> @Html.LabelFor(o => o.Bin_No)<br> @Html.EditorFor(o => o.Bin_No)<br> <br /><br> @Html.LabelFor(o => o.Order_No)<br> @Html.EditorFor(o => o.Order_No)<br> <br /><br> @Html.LabelFor(o => o.Time)<br> @Html.EditorFor(o => o.Time)<br> <br /><br></div><br>Here is the View to display the grid:
<div class="grid">
<div class="grid"> @( Html.Telerik().Grid<DispatcherRequestDetails_Receiving>() .BuildGrid( "DispatcherRequestGrid", "DispatcherRequestDetails_Receiving", Model.DispatcherRequest_ID.ToString() ) )And here is the helper method being used to create the grid:
public static GridBuilder<T> BuildGrid<T>( this GridBuilder<T> gridbuilder, string gridName, string ajaxController, object indexID) where T : class{ GridBuilder<T> retVal = gridbuilder.Name(gridName) .EnableCustomBinding(true) .ToolBar(commands => commands.Insert()) .Editable(editing => editing.Mode(Telerik.Web.Mvc.UI.GridEditMode.PopUp).Window(w => w.Modal(true))) .Pageable(paging => paging.PageSize(20) .Style(Telerik.Web.Mvc.UI.GridPagerStyles.NextPreviousAndNumeric) .Total(100)) .DataBinding(bindings => bindings.Ajax() .Select("_Index", ajaxController, new { id = indexID }) .Insert("_Insert", ajaxController) .Update("_Update", ajaxController) .Delete("_Delete", ajaxController)); Type typeT = typeof(T); PropertyInfo[] properties = typeT.GetProperties(); // Add keys GridDataKeyFactory<T> dataKeys = new GridDataKeyFactory<T>(retVal); foreach(PropertyInfo property in properties) if(IsAttributePresent<KeyAttribute>(property)) dataKeys.Add(property.Name); // Add Columns GridColumnFactory<T> columns = new GridColumnFactory<T>(retVal); foreach (PropertyInfo property in properties) if(!IsAttributePresent<HiddenInputAttribute>(property)) columns.Bound(property.Name); columns.Command(commands => { commands.Edit().ButtonType(Telerik.Web.Mvc.UI.GridButtonType.Text); commands.Delete().ButtonType(Telerik.Web.Mvc.UI.GridButtonType.Text); } ); return retVal;}I have seen a thread similar to my issue: http://www.telerik.com/community/forums/aspnet-mvc/grid/update-button-on-not-closing-popup.aspx
But it talks about updating to a version which is older than one that I use.
Any help is appreciated.
Thanks.
Subhendu.