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

Getting value from dropdownlist into Grid update call?

1 Answer 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Spirent
Top achievements
Rank 1
Spirent asked on 13 Aug 2014, 12:36 PM
I have a Kendo grid:

@(Html.Kendo().Grid<Grid>().Name("Grid")
.DataSource(ds => ds
.Ajax()
.Model(model => model.Id(m => m.ID))
.Read(read => read.Action("Grid_Read", "Sessions", new {sessionId = ViewBag.SessionID}))
.Update(update =>
update.Action("Grid_Update", "Sessions", new {
sessionId = ViewBag.SessionID, qcStateId = 'currently selected qcstatusheader value'}))
.PageSize(10)
.Batch(true)
)
.ToolBar(toolbar =>
{
toolbar.Template(
"| Set selected to: " + @Html.Partial("EditorTemplates/QCStatusHeader"));
}
)

QCStatusHeader:

@(Html.Kendo().DropDownList()
.Name("QCStatusHeader")
.DataValueField("Id")
.DataTextField("Name")
.BindTo((List<NomadBase.Web.ViewModels.Shared.QCStateViewModel>)ViewBag.PossibleQCStatesHeader)

)

How do I get the selected value from the QCStatusHeader dropdownlist into my update call to the controller?
Thanks.

1 Answer, 1 is accepted

Sort by
0
Spirent
Top achievements
Rank 1
answered on 13 Aug 2014, 07:30 PM
The .Data option was what I was looking for.

    .Update(update => update.Action("Grid_Update", "Sessions", new {sessionId = ViewBag.SessionID})
        .Data("QCStatusHeaderValue"))

    function QCStatusHeaderValue() {
            var value = $('#QCStatusHeader').data("kendoDropDownList").value();
            return { qcStateId: value };
        }
Tags
Grid
Asked by
Spirent
Top achievements
Rank 1
Answers by
Spirent
Top achievements
Rank 1
Share this question
or