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:
And my Javascript:
Any help would be greatly appreciated!
Thanks,
Landon
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")
)
function
filterContacts_EndUser() {
return
{
accountId: $(
"#AccountID"
).val()
};
}
Thanks,
Landon