title: Kendo Grid - How to disable cascaded dropdownlistfor when in edit mode and enable it when add mode?
body: <p>I would like to disable the <code>DropDownListFor</code> which is cascading from another dropdownlist in editor while editing a record and keep it enable while in adding a record. I am using Kendo Grid in my MVC project.</p>
  
  <p>Here I would like to disable Country Dropdownlist and location dropdownlist when in edit mode and keep enable when in add(insert new record) mode</p>
  
  <p>The code is as below:</p>
  
  <p>Grid:</p>
  
  <pre><code>@(Html.Kendo().Grid&lt;Webapplication1.Models.mainViewModel&gt;()
      .Name("mainGrid")
      .Columns(c =&gt;
      {
          c.Bound(m =&gt; m.Id).Hidden();
          c.Bound(m =&gt; m.CountryViewModel.CountryName)
              .Title("Country").HeaderHtmlAttributes(new { @title = "Countries" });
          c.Bound(m =&gt; m.LocationViewModel.LocationName)
              .Title("Location").HeaderHtmlAttributes(new { @title = "Locations" });
          c.Command(p =&gt;
          {p.Edit().Text(" ").UpdateText(" ").CancelText(" ").HtmlAttributes(new { @title = "Edit" });});
      })
      .ToolBar(toolbar =&gt; { toolbar.Create().Text("").HtmlAttributes(new { @title = "Add"}); })
      .Editable(editable =&gt; editable.Mode(Kendo.Mvc.UI.GridEditMode.PopUp).TemplateName("gridEditor"))
      .DataSource(dataSource =&gt; dataSource
  .Ajax()
          .PageSize(10)
          .Read(read =&gt; read.Action("mainGrid_Read", "abc"))
      .Update(update =&gt; update.Action("mainGrid_Update", "abc"))
      .Create(create =&gt; create.Action("mainGrid_Create", "abc"))
          .Model(m =&gt; { m.Id(p =&gt; p.Id);
            m.Field(p =&gt; p.CountryViewModel).DefaultValue(ViewData["DefaultCountry"] as Webapplication1.Models.CountryViewModel);      
          })
      )
  )
  </code></pre>
  
  <p>Country DropDownList:</p>
  
  <pre><code>@model Webapplication1.Models.CountryViewModel
  
  @(Html.Kendo().DropDownListFor(m =&gt; m)
      .AutoBind(false)
      .OptionLabel("Select")
      .DataValueField("CountryId")
      .DataTextField("CountryName") 
      .DataSource(dataSource =&gt;
                    {
                        dataSource.Read(read =&gt; read.Action("GetCountries", "abc").Type(HttpVerbs.Post))
                                  .ServerFiltering(true);
                    })
  )
  @Html.ValidationMessageFor(m =&gt; m)
  </code></pre>
  
  <p>Location DropDownList:</p>
  
  <pre><code>@model Webapplication1.Models.LocationViewModel
  
  @(Html.Kendo().DropDownListFor(m =&gt; m)
      .OptionLabel("Select")
      .DataValueField("LocationId")
      .DataTextField("LocationName")
      .AutoBind(false)
      .DataSource(d =&gt;
      {
          d.Read(read =&gt;
          {
              read.Action("GetLocationsByCountryId", "abc").Type(HttpVerbs.Post).Data("getCountryId");
          }).ServerFiltering(true);
      })
      .CascadeFrom("CountryViewModel")
  )
  @Html.ValidationMessageFor(m =&gt; m)
  </code></pre>
  
  <p>Popup editor:</p>
  
  <pre><code>@model Webapplication1.Models.mainViewModel
  &lt;table&gt;
      @Html.HiddenFor(m =&gt; m.Id)
      &lt;tr&gt;
          &lt;td&gt;@Html.Label("Country:")&lt;/td&gt;
          &lt;td&gt;@Html.EditorFor(m =&gt; m.CountryViewModel)&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;@Html.Label("Location:")&lt;/td&gt;
          &lt;td&gt;@Html.EditorFor(m =&gt; m.LocationViewModel)&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>