Hi
I saw the below link
http://demos.kendoui.com/web/combobox/cascadingcombobox.html
i have three combo box
@(Html.Kendo().ComboBox()
.Name("userComboBox") //The name of the combobox is mandatory. It specifies the "id" attribute of the widget.
.DataTextField("UserName") //Specifies which property of the Product to be used by the combobox as a text.
.DataValueField("UserID") //Specifies which property of the Product to be used by the combobox as a value.
.Filter(FilterType.StartsWith)
.Placeholder("Select Name...")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetUsers", "UserDetails").Data("onAdditionalData"); //Set the Action and Controller name
})
.ServerFiltering(true); //If true the DataSource will not filter the data on the client.
}).Events(e=>e.Change("combobox_change"))
//Select first item.
)
@(Html.Kendo().ComboBox().Name("entityDetails")
.DataTextField("EntityName")
.DataValueField("EntityID")
.DataSource(source => {
source.Read(read =>
{
read.Action("GetEntity", "UserDetails").Data("onAdditionalDataEntity");
})
.ServerFiltering(true);
}) .SelectedIndex(0)
.CascadeFrom("userComboBox")
)
@(Html.Kendo().ComboBox().Name("ClientDetails")
.DataTextField("ClientName")
.DataValueField("ClientID")
.DataSource(source => {
source.Read(read =>
{
read.Action("GetClientDetails", "UserDetails").Data("onAdditionalDataForClient");
})
.ServerFiltering(true);
})
.SelectedIndex(0)
.CascadeFrom("userComboBox")
)
//js
function onAdditionalData() {
var data = $("#userComboBox").data("kendoComboBox")
value1 = data.input.val();
return {
text: value1
};
}
function onAdditionalDataEntity() {
var data = $("#userComboBox").data("kendoComboBox")
value1 = $("#userComboBox").val();
return {
userData: value1,
entity: $("#entityDetails").data("kendoComboBox").input.val()
};
}
function onAdditionalDataForClient() {
var data = $("#userComboBox").data("kendoComboBox")
value1 = $("#userComboBox").val();
return {
userData: value1,
entity: $("#ClientDetails").data("kendoComboBox").input.val()
};
}
//controller
public JsonResult GetUsers(string text)
{
return Json(GetActiveUser, JsonRequestBehavior.AllowGet);
}
public JsonResult GetClientDetails(string userData, string entity)
{
// return userDetailsDAO.GetUserDetails(id);
return Json(GetClientDetails, JsonRequestBehavior.AllowGet);
}
public JsonResult GetEntity(string userData, string entity)
{
return Json(GetEntityDetails, JsonRequestBehavior.AllowGet);
}
1) user combo box need to cascade with other two so when i load user combo i need to load and select details
2) i can do load but cant select the first item
Can you guys help me
Senthil
I saw the below link
http://demos.kendoui.com/web/combobox/cascadingcombobox.html
i have three combo box
@(Html.Kendo().ComboBox()
.Name("userComboBox") //The name of the combobox is mandatory. It specifies the "id" attribute of the widget.
.DataTextField("UserName") //Specifies which property of the Product to be used by the combobox as a text.
.DataValueField("UserID") //Specifies which property of the Product to be used by the combobox as a value.
.Filter(FilterType.StartsWith)
.Placeholder("Select Name...")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetUsers", "UserDetails").Data("onAdditionalData"); //Set the Action and Controller name
})
.ServerFiltering(true); //If true the DataSource will not filter the data on the client.
}).Events(e=>e.Change("combobox_change"))
//Select first item.
)
@(Html.Kendo().ComboBox().Name("entityDetails")
.DataTextField("EntityName")
.DataValueField("EntityID")
.DataSource(source => {
source.Read(read =>
{
read.Action("GetEntity", "UserDetails").Data("onAdditionalDataEntity");
})
.ServerFiltering(true);
}) .SelectedIndex(0)
.CascadeFrom("userComboBox")
)
@(Html.Kendo().ComboBox().Name("ClientDetails")
.DataTextField("ClientName")
.DataValueField("ClientID")
.DataSource(source => {
source.Read(read =>
{
read.Action("GetClientDetails", "UserDetails").Data("onAdditionalDataForClient");
})
.ServerFiltering(true);
})
.SelectedIndex(0)
.CascadeFrom("userComboBox")
)
//js
function onAdditionalData() {
var data = $("#userComboBox").data("kendoComboBox")
value1 = data.input.val();
return {
text: value1
};
}
function onAdditionalDataEntity() {
var data = $("#userComboBox").data("kendoComboBox")
value1 = $("#userComboBox").val();
return {
userData: value1,
entity: $("#entityDetails").data("kendoComboBox").input.val()
};
}
function onAdditionalDataForClient() {
var data = $("#userComboBox").data("kendoComboBox")
value1 = $("#userComboBox").val();
return {
userData: value1,
entity: $("#ClientDetails").data("kendoComboBox").input.val()
};
}
//controller
public JsonResult GetUsers(string text)
{
return Json(GetActiveUser, JsonRequestBehavior.AllowGet);
}
public JsonResult GetClientDetails(string userData, string entity)
{
// return userDetailsDAO.GetUserDetails(id);
return Json(GetClientDetails, JsonRequestBehavior.AllowGet);
}
public JsonResult GetEntity(string userData, string entity)
{
return Json(GetEntityDetails, JsonRequestBehavior.AllowGet);
}
1) user combo box need to cascade with other two so when i load user combo i need to load and select details
2) i can do load but cant select the first item
Can you guys help me
Senthil