This is a migrated thread and some comments may be shown as answers.

Multicolumn in combobox

3 Answers 146 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Teo
Top achievements
Rank 1
Teo asked on 10 Jun 2014, 03:41 PM
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);
        }


3 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 10 Jun 2014, 04:00 PM
Hi Teo,


Could you please specify what issue are you experiencing - Is the page not loaded at all, is the widget not initialized or the data is not received? As a general advice I would suggest you to check the browsers console for JavaScript errors and also the network tab of the developer tools to assure that the data is received as expected.

I am looking forward to hearing from you.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Teo
Top achievements
Rank 1
answered on 10 Jun 2014, 04:33 PM
Hi Dimiter,

Thank you for your reply.

When i use the combo box without template, it works. But I can not receive data when attach the temple for multi-column in combo box... 

This is my error: JavaScript critical error in (unknown source location)\n\nSCRIPT1009: Expected '}'
0
Dimiter Madjarov
Telerik team
answered on 10 Jun 2014, 04:46 PM
Hi Teo,


Since the current error does not state much about the issue and there is no noticeable problem in the provided sample code, would it be possible to send us a small isolated project, which demonstrates the case? The sample data is not important, only a single page with the ComboBox would be enough for us to inspect it.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
ComboBox
Asked by
Teo
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Teo
Top achievements
Rank 1
Share this question
or