This is a migrated thread and some comments may be shown as answers.

Kendo MVCV popup window in grid-edit mode won't bind data

3 Answers 268 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sig
Top achievements
Rank 1
Sig asked on 16 Aug 2012, 08:00 AM
Hey all,

I'm coming across some strange issues.  In my "create" button on my kendo MVC grid (using the defaults for the grid, such as:
.ToolBar(commands => commands.Create()

1] I can't override the default width of the window with the "min size" properties, or any other html attributes to work when creating a window from the create / update button within a grid.  I basically want it to be a square, 450x450, and can't accomplish this by adding in new { @style="height:450px; width:450px"} or the minHeight/minWidth property of the window inside my grid. 

What do I do to get the popup-edit window in my grid to seize according to my definition?

2]  In my grid, I have this:
.Editable(editable => editable.Mode(GridEditMode.PopUp)
                                                .TemplateName("PolicyViewModel")
                                                .Window(window => window.Title("Manage Policy"))))


In a SharedTemplate for the editor pop-up window, I have a couple of drop downs, e.g.:
@(Html.Kendo().DropDownListFor(m=>m.SourceId)
        .SelectedIndex(0)
              .DataTextField("Name")
              .DataValueField("Id")
              .Value(Model.SourceId.ToString(CultureInfo.InvariantCulture))
              .BindTo(ViewBag.sources))         


The drop down binds perfectly well, but on submitting the data, my selections (and defaults) are always ignored / never sent over the wire.  I'm not too sure why at this point...

Why oh why is that the case?  What am I doing incorrectly?

3 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 16 Aug 2012, 09:10 PM
Same problem here...
0
Accepted
Daniel
Telerik team
answered on 21 Aug 2012, 07:53 AM
Hi,

The popup properties will not be applied if Ajax binding is used since they are not serialized. You could set them with client-side code after the Grid initialization e.g.

$(function () {
     var grid = $("#Grid").data("kendoGrid");
     grid.options.editable.window.title = "MyTitle";
 })
I am not sure what could be causing the problem with the DropDownList. Could you provide a sample project  so I can investigate what exactly goes wrong? Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Sig
Top achievements
Rank 1
answered on 22 Aug 2012, 03:21 AM
Thanks Daniel,

That makes sense, I will add the attributes in javascript instead of via the MVC helpers.

The other issue I had seemed to be an errant second $(document).ready() floating in my code, which was making initialization of the drop down fail.

Thanks again,
-Sig
Tags
Grid
Asked by
Sig
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Daniel
Telerik team
Sig
Top achievements
Rank 1
Share this question
or