Custom Popup Editor pass parameter to datasource keying off of Edit or Create

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

I have a custom popup editor which has a DropDownListFor which has a datasource.    I need to pass a parameter to the Read method which is a  .NET action.   The parameter needs to be whether or not we are in update or create mode.

I currently pass CompanyId from the ViewData but I need one more param as mentioned above.   Since Model is null always in Edit or Create mode I cannot key off of that.


            @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)

No answers yet. Maybe you can help?

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