Cascading ComboBox not loading items on Edit Page

3 posts, 1 answers
  1. Landon
    Landon avatar
    66 posts
    Member since:
    Nov 2010

    Posted 03 Sep 2013 Link to this post

    Hi,

    I'm using Cascading ComboBoxes to outline a Account and it's Primary Contact. The Account ComboBox cascades down to the Primary Contact ComboBox, which loads a list of Contacts for that Account.

    This all seems to work fine on my Create page, but when re-loading the data on the Edit page it hiccups a bit. The initial "Account" ComboBox loads properly, but the Primary Contact Box does not. When Inspecting the Object on the page, the value is properly set, but the ComboBox simply shows the Placeholder Text.

    Sometimes when loading the page in debug mode, you can see the initial Values get put into the ComboBoxes, but the Primary Contact fails to set the selected item properly. This behaviour almost seems like it's a timing issue?

    I've outlined my two ComboBoxes in the code below:
    @(Html.Kendo().ComboBox()
      .Name("AccountID")
      .DataTextField("AccountName")
      .DataValueField("AccountID")
      .Placeholder("Not Applicable/No End User Known")
      .Filter(FilterType.Contains)
      .HtmlAttributes(new { style = "width: 325px;" })
      .Events(e =>
          {
              e.Change("onChange_EndUser");
          })
      .DataSource(source =>
          {
              source.Read(read =>
                  {
                      read.Action("GetEndUserAccounts", "Accounts");
                  });
          })
      )
     
    @(Html.Kendo().ComboBox()
      .Name("PrimaryContactID")
      .DataTextField("Name")
      .DataValueField("ContactID")
      .Placeholder("Not Applicable/No Contact is Known")
      .Filter(FilterType.Contains)
      .HtmlAttributes(new { style = "width: 325px"})
      .DataSource(source =>
          {
              source.Read(read =>
                  {
                      read.Action("GetAccountContacts", "Contacts").Data("filterContacts_EndUser");
                  })
                  .ServerFiltering(true);
          })
      .CascadeFrom("AccountID")
      )
    And my Javascript:
    function filterContacts_EndUser() {
           return {
               accountId: $("#AccountID").val()
           };
       }
    Any help would be greatly appreciated!

    Thanks,
    Landon
  2. Answer
    Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 05 Sep 2013 Link to this post

    Hello Landon,

    I am not really sure what is behind this, however as demonstrated in the Demo:

    http://demos.kendoui.com/web/combobox/cascadingcombobox.html

    You need to set the AutoBind option to false for the child ComboBoxes.

    If it does not help please demonstrate the case in a sample project so we can investigate further.

    Kind Regards,
    Petur Subev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Landon
    Landon avatar
    66 posts
    Member since:
    Nov 2010

    Posted 05 Sep 2013 Link to this post

    Hi Petur,

    The AutoBind(false) seems to have fixed my issue. 

    I'm glad it wasn't anything major!

    Thanks for the help,
    Landon
Back to Top