Hi i'm quite stuck on initializing multiple cascading DropDown Lists with the MVC wrappers:
The Same sample works with Kendo Web but not with the MVC Wrappers.
All 4 DropDowns get the values from the controller.
You are not allowed to change the first dropdown thats why it is disabled.
all other dropdown should be prefilled with the values from the controller.
The Data from Select Devices is also passed to the client. it look like this:
[{"DeviceId":7,"Name":"Device Customer CA 1"},{"DeviceId":8,"Name":"Device Customer CA 2"},{"DeviceId":9,"Name":"Device Customer CA 3"},{"DeviceId":10,"Name":"Device Customer CA 4"}]
This is the code from the view:
<div class="editor-label">
@Html.LabelFor(model => model.SalesOrgId)
</div>
<div class="editor-field">
@(Html.Kendo().ComboBox()
.Name("SalesOrgId")
.Placeholder(Resources.MappingRules.Strings.SelectSalesOrgDropDown)
.DataTextField("Name")
.DataValueField("SalesOrgId")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("SelectSalesOrgs", "MappingRules");
})
.ServerFiltering(true);
})
.Enable(false)
)
@Html.ValidationMessageFor(model => model.SalesOrgId)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.CustomerId)
</div>
<div class="editor-field">
@(Html.Kendo().ComboBox()
.Name("CustomerId")
.Placeholder(Resources.MappingRules.Strings.SelectCustomerDropDown)
.DataTextField("Name")
.DataValueField("CustomerId")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("SelectCustomers", "MappingRules").Data("filterCustomers");
})
.ServerFiltering(true);
})
.AutoBind(false)
.CascadeFrom("SalesOrgId")
)
@Html.ValidationMessageFor(model => model.CustomerId)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.DeviceId)
</div>
<div class="editor-field">
@(Html.Kendo().ComboBox()
.Name("DeviceId")
.Placeholder(Resources.MappingRules.Strings.SelectDeviceDropDown)
.DataTextField("Name")
.DataValueField("DeviceId")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("SelectDevices", "MappingRules").Data("filterDevices");
})
.ServerFiltering(true);
})
.AutoBind(false)
.CascadeFrom("CustomerId")
)
@Html.ValidationMessageFor(model => model.DeviceId)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.EntityId)
</div>
<div class="editor-field">
@(Html.Kendo().ComboBox()
.Name("EntityId")
.Placeholder(Resources.MappingRules.Strings.SelectEntityDropDown)
.DataTextField("Name")
.DataValueField("EntityId")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("SelectEntities", "MappingRules");
})
.ServerFiltering(true);
})
.AutoBind(false)
.CascadeFrom("DeviceId")
)
@Html.ValidationMessageFor(model => model.EntityId)
</div>
Here ist my controller code:
public JsonResult SelectSalesOrgs()
{
var salesOrgs = GetSalesOrgs();
return Json(salesOrgs, JsonRequestBehavior.AllowGet);
}
public JsonResult SelectCustomers(int salesOrgId)
{
var customers = GetCustomersBySalesOrgId(salesOrgId);
return Json(customers, JsonRequestBehavior.AllowGet);
}
public JsonResult SelectDevices(int customerId)
{
var devices = GetDevicesByCustomerId(customerId);
return Json(devices, JsonRequestBehavior.AllowGet);
}
public JsonResult SelectEntities()
{
var entities = GetEntities();
return Json(entities, JsonRequestBehavior.AllowGet);
}
Any help would be appreciated.
The Same sample works with Kendo Web but not with the MVC Wrappers.
All 4 DropDowns get the values from the controller.
You are not allowed to change the first dropdown thats why it is disabled.
all other dropdown should be prefilled with the values from the controller.
The Data from Select Devices is also passed to the client. it look like this:
[{"DeviceId":7,"Name":"Device Customer CA 1"},{"DeviceId":8,"Name":"Device Customer CA 2"},{"DeviceId":9,"Name":"Device Customer CA 3"},{"DeviceId":10,"Name":"Device Customer CA 4"}]
This is the code from the view:
<div class="editor-label">
@Html.LabelFor(model => model.SalesOrgId)
</div>
<div class="editor-field">
@(Html.Kendo().ComboBox()
.Name("SalesOrgId")
.Placeholder(Resources.MappingRules.Strings.SelectSalesOrgDropDown)
.DataTextField("Name")
.DataValueField("SalesOrgId")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("SelectSalesOrgs", "MappingRules");
})
.ServerFiltering(true);
})
.Enable(false)
)
@Html.ValidationMessageFor(model => model.SalesOrgId)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.CustomerId)
</div>
<div class="editor-field">
@(Html.Kendo().ComboBox()
.Name("CustomerId")
.Placeholder(Resources.MappingRules.Strings.SelectCustomerDropDown)
.DataTextField("Name")
.DataValueField("CustomerId")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("SelectCustomers", "MappingRules").Data("filterCustomers");
})
.ServerFiltering(true);
})
.AutoBind(false)
.CascadeFrom("SalesOrgId")
)
@Html.ValidationMessageFor(model => model.CustomerId)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.DeviceId)
</div>
<div class="editor-field">
@(Html.Kendo().ComboBox()
.Name("DeviceId")
.Placeholder(Resources.MappingRules.Strings.SelectDeviceDropDown)
.DataTextField("Name")
.DataValueField("DeviceId")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("SelectDevices", "MappingRules").Data("filterDevices");
})
.ServerFiltering(true);
})
.AutoBind(false)
.CascadeFrom("CustomerId")
)
@Html.ValidationMessageFor(model => model.DeviceId)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.EntityId)
</div>
<div class="editor-field">
@(Html.Kendo().ComboBox()
.Name("EntityId")
.Placeholder(Resources.MappingRules.Strings.SelectEntityDropDown)
.DataTextField("Name")
.DataValueField("EntityId")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("SelectEntities", "MappingRules");
})
.ServerFiltering(true);
})
.AutoBind(false)
.CascadeFrom("DeviceId")
)
@Html.ValidationMessageFor(model => model.EntityId)
</div>
Here ist my controller code:
public JsonResult SelectSalesOrgs()
{
var salesOrgs = GetSalesOrgs();
return Json(salesOrgs, JsonRequestBehavior.AllowGet);
}
public JsonResult SelectCustomers(int salesOrgId)
{
var customers = GetCustomersBySalesOrgId(salesOrgId);
return Json(customers, JsonRequestBehavior.AllowGet);
}
public JsonResult SelectDevices(int customerId)
{
var devices = GetDevicesByCustomerId(customerId);
return Json(devices, JsonRequestBehavior.AllowGet);
}
public JsonResult SelectEntities()
{
var entities = GetEntities();
return Json(entities, JsonRequestBehavior.AllowGet);
}
Any help would be appreciated.