Custom popup editor, getting value from Model in edit mode and using it as DropDownList datasource parameter

0 Answers 113 Views
Grid
Jordan
Top achievements
Rank 1
Iron
Jordan asked on 03 Jan 2023, 07:10 AM

I have a custom popup grid editor (which is a partial view).   Model is always null in the editor so I cannot access the Model to key off values.

I have a datasource for this dropdown list as you can see below.  I need to add a userId parameter to this datasource when in edit mode.  Unfortunately I have not been able to figure out how to get that value since Model is null.

Any tricks I can do here?

<div class="editor-container">
    <div class="row">
        <div class="col">
            @Html.LabelFor(m => m.UserId)
            @(Html.Kendo().DropDownListFor(m => m.UserId)
             .OptionLabel("Select..")
             .DataTextField("Text")
             .DataValueField("Value")
                 .DataSource(dataSource => {
                        dataSource.Custom()
                                  .Type("aspnetmvc-ajax")
                                  .Transport(transport => transport.Read("Global_SalesUsers_DropDown", "Company", new {companyId = companyId}))
                                    .Schema(schema => schema.Data("Data"))
                                    .Events(events => events.RequestEnd("processViewDataResponse"));
                    })           
            )
           @Html.ValidationMessageFor(m => m.UserId)
        </div>
    </div>


No answers yet. Maybe you can help?

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