This question is locked. New answers and comments are not allowed.
Hi,
I am attempting to center the pop-up edit form and have tried the previously posted solutions with mixed results.
I have one grid that works using the solution:
Using the following on edit
But with the following grid I get an error in the javascript indicating that center() is undefined. That error is resulting from .data("tWindow") returning null. (Of course the pop-up is not centered when the error occurs.)
In fact both of these grids are in the same view, and I can edit as many times as I want with the first grid and I get no error. Once I edit with the second grid, I get the error and then I get the error for both grids.
I've tested in both IE 9 and FF 8. Using MVC Extensions Q2 2011.
I am attempting to center the pop-up edit form and have tried the previously posted solutions with mixed results.
I have one grid that works using the solution:
@(Html.Telerik().Grid(Model.RFQFiles).Name("FileGrid") .ToolBar(c => c.Insert().ButtonType(GridButtonType.Text)) .Editable(c => c.Mode(GridEditMode.PopUp).DefaultDataItem( new RFQFile { RFQID = Model.RFQID, EditUserID = ViewBag.UserID, CreateUserID = ViewBag.UserID }).FormHtmlAttributes(new { id = "FileGridform", name = "FileGridform" })) .DataKeys(keys => { keys.Add(f => f.RFQFileID); keys.Add(f => f.RFQID).RouteKey("RFQID"); }) .DataBinding(dataBinding => { dataBinding.Ajax() .Insert("_InsertDocument", "RFQRequest") .Select("_SelectDocument", "RFQRequest") .Update("_UpdateDocument", "RFQRequest") .Delete("_DeleteDocument", "RFQRequest"); }) .Columns(columns => { columns.Command(c => c.Delete().ButtonType(GridButtonType.Text)); columns.Bound(f => f.Name).Title("File Name"); columns.Bound(f => f.Detail).Title("Description"); }) .ClientEvents(events => events.OnDataBinding("onGridDataBinding").OnDataBound("onFileGridDataBound").OnEdit("onGridEditing").OnSave("onSave")) .NoRecordsTemplate("Loading, please wait..."))Using the following on edit
function onGridEditing(e) { $(e.form) .closest(".t-window") .css("marginLeft", 0) .data("tWindow") .center();}But with the following grid I get an error in the javascript indicating that center() is undefined. That error is resulting from .data("tWindow") returning null. (Of course the pop-up is not centered when the error occurs.)
@(Html.Telerik().Grid(Model.RFQParts).Name("PartGrid") .ToolBar(c => c.Insert().ButtonType(GridButtonType.Text)) .Editable(c => c.Mode(GridEditMode.PopUp).DefaultDataItem( new RFQPart { RFQID = Model.RFQID, EditUserID = ViewBag.UserID, CreateUserID = ViewBag.UserID }).FormHtmlAttributes(new { id = "PartGridform", name = "PartGridform" })) .DataKeys( keys => { keys.Add(f => f.RFQPartID); keys.Add(f => f.RFQID).RouteKey("RFQID"); }) .DataBinding(dataBinding => { dataBinding.Ajax() .Insert("_InsertPart", "RFQRequest") .Select("_SelectParts", "RFQRequest") .Update("_UpdatePart", "RFQRequest") .Delete("_DeletePart", "RFQRequest"); }) .Columns(columns => { columns.Bound(p => p.ProgramName).Title("Program"); columns.Bound(p => p.ApplicationLabel).Title("Application"); columns.Bound(p => p.CatalogPart).Title("Allegro / Sanken Part"); columns.Bound(p => p.TargetASP).Title("Target Price"); }) .ClientEvents(events => events.OnDataBinding("onGridDataBinding").OnDataBound("onPartGridDataBound").OnEdit("onGridEditing")) .NoRecordsTemplate("Loading, please wait..."))In fact both of these grids are in the same view, and I can edit as many times as I want with the first grid and I get no error. Once I edit with the second grid, I get the error and then I get the error for both grids.
I've tested in both IE 9 and FF 8. Using MVC Extensions Q2 2011.