@(Html.Kendo().ComboBoxFor(m => m.CurrentBooking.Resource.ResourceId)
.Name(
"resourceAutoComplete"
)
.DataTextField(
"ResourceName"
)
.DataValueField(
"ResourceId"
)
.BindTo(Model.Resources)
.Placeholder(
"Select resource"
))
What am I doing wrong in my ComboBoxFor() configuration?
11 Answers, 1 is accepted
When strongly bound HTML helper is used, a.k.a ComboBoxFor<T>, do not set the Name manually. I will suggest you remove the Name method of the declaration of the widget.
Georgi Krustev
the Telerik team
No, this is not a bug. This is the way ASP.NET MVC model binding works. It expects the name of the input to match the property name of the model. If there is no such match then it won't work.
More info can be found in this blog post.
Regards,
Atanas Korchev
Telerik
Thanks,
Gerber
In order for cascading to work you need to specify the actual ID of the parent combobox - the one that ASP.NET MVC has generated for it. You can either inspect the generated HTML output to get the actual ID or override the ID of the combobox via the HtmlAttributes method:
@(Html.Kendo().ComboBoxFor().HtmlAttributes(new { id = "myid" })
@(Html.Kendo().ComboBoxFor().CascadeFrom("myid"))
Regards,
Atanas Korchev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Hi, Atanas
When i try to cascade comboboxfor, it wil hides other comboboxes.
@(Html.Kendo().ComboBoxFor(m => m.SubgroupCode)
.HtmlAttributes(new { style = "width:160px", id = "Subgroupid" })
.Placeholder("Select product...")
.DataTextField("Name")
.DataValueField("ID")
.Filter(FilterType.Contains)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetAssetSubgroup", "Asset").Data("filterSubGroups");
})
.ServerFiltering(true);
})
.Enable(false)
.AutoBind(false)
.CascadeFrom("groupid")
)
<
script
>
function filterSubGroups() {
return {
groups: $("#groupid").val(),
groupfilter: $("#Subgroupid").data("kendoComboBox").input.val()
};
}
</
script
>
</
td
>
please help me
Thanks Man
Regards
Hi Micky,
Do you need any assistance with this thread?
Regards,
Petar
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
I would like to pickup on this thread. I have added the id
@(Html.Kendo().ComboBoxFor(m=>m.MyProp)
.HtmlAttributes(new { style = "width:100%;", id = "myId" })
But my other control is still not firing on change.
.CascadeFrom("myId")
What am I missing?
Hello Kevin,
Attached you will find a small project with Cascading Comboboxes, with an id HtmlAttribute added to the parent component. Could you please review it and see if it will help you resolve the problem? Feel free to modify the example to show any issues you are experiencing on the matter.
Looking forward to your reply.
Regards,
Martin
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.