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

Cascading ComboBox not loading items on Edit Page

2 Answers 117 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Landon
Top achievements
Rank 2
Landon asked on 03 Sep 2013, 05:19 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Petur Subev
Telerik team
answered on 05 Sep 2013, 08:59 AM
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!
0
Landon
Top achievements
Rank 2
answered on 05 Sep 2013, 02:27 PM
Hi Petur,

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

I'm glad it wasn't anything major!

Thanks for the help,
Landon
Tags
ComboBox
Asked by
Landon
Top achievements
Rank 2
Answers by
Petur Subev
Telerik team
Landon
Top achievements
Rank 2
Share this question
or