Hi Telerik team,
I'm a new bie in ASP.net MVC and telerik. When i create my project, i met the problem in multicolumn in combobox like your demo at : http://demos.telerik.com/aspnet-mvc/combobox/template... I don't attach the headertemplate because i don't need the title of column. But it cannot run when i add template ..hope your suggestion.
here is test.cshtml file:
@(Html.Kendo().ComboBox()
.Name("test")
.DataTextField("Category")
.DataValueField("Category")
.Filter("startswith")
.MinLength(1)
.HtmlAttributes(new { style = "width:250px" })
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetCategory", "User");
})
.ServerFiltering(false);
})
.Template("<span class=\"k-state-default\">#: data.Category #</span>" +
"<span class=\"k-state-default\">#: data.ProductID #</span>")
)
and the getcategory method in usercontroller:
public JsonResult GetCategory()
{
var a = new DataClasses1DataContext().Dat_Hangs.Select(b => new OrderViewModel
{
ProductID = b.ProductID,
ShopID = b.ShopID,
OID = b.OID,
Category = b.Category,
Quantity = b.Quantity,
Price = b.Price
});
return Json(a, JsonRequestBehavior.AllowGet);
}
I'm a new bie in ASP.net MVC and telerik. When i create my project, i met the problem in multicolumn in combobox like your demo at : http://demos.telerik.com/aspnet-mvc/combobox/template... I don't attach the headertemplate because i don't need the title of column. But it cannot run when i add template ..hope your suggestion.
here is test.cshtml file:
@(Html.Kendo().ComboBox()
.Name("test")
.DataTextField("Category")
.DataValueField("Category")
.Filter("startswith")
.MinLength(1)
.HtmlAttributes(new { style = "width:250px" })
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetCategory", "User");
})
.ServerFiltering(false);
})
.Template("<span class=\"k-state-default\">#: data.Category #</span>" +
"<span class=\"k-state-default\">#: data.ProductID #</span>")
)
and the getcategory method in usercontroller:
public JsonResult GetCategory()
{
var a = new DataClasses1DataContext().Dat_Hangs.Select(b => new OrderViewModel
{
ProductID = b.ProductID,
ShopID = b.ShopID,
OID = b.OID,
Category = b.Category,
Quantity = b.Quantity,
Price = b.Price
});
return Json(a, JsonRequestBehavior.AllowGet);
}