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

Dynamic Partial View within Custom Popup Editor Template

0 Answers 156 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Elliott
Top achievements
Rank 1
Elliott asked on 24 Jan 2014, 04:26 PM
Hi,
I think I have run into this problem and have been unable to find an answer:
http://www.telerik.com/community/forums/aspnet-mvc/tabstrip/tabstrip-in-grid-popup-window-and-passing-parameter-from-model.aspx

I have a custom partial view for the edit popup, within this partial view I have another which is dynamic based on a grid row value. E.g.

Grid:
.Editable(editable => editable
        .Mode(GridEditMode.PopUp)
        .TemplateName("AddEditPartial")
 )

AddEditPartial:
@* Drop Down *@
        <div id="dropdown">
            <div class="editor-label">
                @Html.Label("Dropdown")
            </div>
            <div class="editor-field">
                @Html.Partial("EditorTemplates/DropdownEditor", Model.ID)
                 // I can see this model value in the grid column
                 // but it passes in an empty Guid to the partial
            </div>
        </div>

Strangely if I do something like:
@Html.TextAreaFor(model => model.ID) // It shows the correct guid in the text area
but
@Html.DisplayFor(model => model.ID) // shows an empty guid 

DropdownEditor:
@model Guid <- is an empty guid so the read action fails
@using Kendo.Mvc.UI
@(Html.Kendo().DropDownList()
    .Name("DropDown") 
    .DataTextField("Text")
    .DataValueField("Value")
    .DataSource(source =>
    {
        source.Read(read =>
        {
            read.Action("Action", "Controller", new { ID= Model }); 
        });
    })
    .OptionLabel("Please Select")
    .SelectedIndex(0)
)

Any ideas? 

Thanks

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Elliott
Top achievements
Rank 1
Share this question
or