This question is locked. New answers and comments are not allowed.
I am using an ajax bound dropdownlist in edit mode for the grid, I need the dropdownlist to be based on the selected value from another dropdownlist on the same row in the grid. How can that be done?
View
// bound field for which I have the custom editorTemplate
Editor Template
Controller method
Could the value somehow be sent to the editortemplate and from there be sent into the parameter through the ajax call?
View
@(Html.Telerik().Grid(Model).Name("Round").DataKeys(keys => keys.Add(o => o.Id).RouteKey("Id")).ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Image).ImageHtmlAttributes(new { style = "margin-left:0" })).DataBinding(dataBinding => dataBinding.Server().Insert("Rounds_update", "Round").Update("Rounds_update", "Round").Delete("Rounds_delete", "Round")).PrefixUrlParameters(false).Columns(columns =>{ columns.Bound(o => o.RoundNo).Width(120); columns.ForeignKey(o => o.GameType, (IEnumerable)ViewData["gameType"], "Key", "value").Width(120); // the bound column below is the one i need the value from for the other dropdown list
columns.Bound(o => o.Course).Width(180); columns.Bound(o => o.Date).Width(180); columns.Bound(o => o.NoInFlight).Width(120).EditorViewData(new { delaultVal = 5 }); columns.Bound(o => o.StartTime).Width(140); columns.Bound(o => o.Interval).Width(170); columns.Bound(o => o.HoleNo).Width(120); // bound field for which I have the custom editorTemplate
columns.Bound(o => o.DefaultTeeboxIdMen); columns.Bound(o => o.DefaultTeeboxIdWomen); columns.Command(commands => { commands.Edit().ButtonType(GridButtonType.Image); commands.Delete().ButtonType(GridButtonType.Image); });})Editor Template
<%@ Control Language="C#" AutoEventWireup="true" Inherits="System.Web.Mvc.ViewUserControl<int>" %><%@ Import Namespace="Telerik.Web.Mvc.UI" %><%= Html.Telerik().DropDownListFor(m => m)
.Name("DefaultTeeboxIdMen")
.BindTo(new SelectList((IEnumerable)ViewData[ShowMe.Tournament.Administration.Helpers.WizardHelper.TeeMen], "HoleId", "Name"))
.DataBinding(bind => bind.Ajax().Select("Ajax_teeboxList", "Ajax")) %>Controller method
public ActionResult Ajax_teeboxList(int? id){ var content = Lists.TeeboxList(id); return new JsonResult { Data = new SelectList(content, "HoleId", "Name") };}Could the value somehow be sent to the editortemplate and from there be sent into the parameter through the ajax call?