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

i am having problem in viewing the data in a list view

4 Answers 140 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Akshay
Top achievements
Rank 1
Akshay asked on 10 May 2013, 11:26 AM
hi i am new to kendo Ui i am having trouble in viewing the data in list view although the data is coming to the page ( i have checked it by viewing the source code of the page). Please Help me.
here is View code

@{
    ViewBag.Title = "ListView";
}

        <link href="../../Content/Kendo/kendo.common.min.css" rel="stylesheet" type="text/css" />
        <link href="../../Content/Kendo/kendo.black.min.css" rel="stylesheet" type="text/css" />
        <script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
        <script src="../../Scripts/Kendo/kendo.all.min.js" type="text/javascript"></script>
        <script src="../../Scripts/Kendo/kendo.aspnetmvc.min.js" type="text/javascript"></script>

<h2>ListView</h2>

@(Html.Kendo().ListView(ViewBag.myList).Name("myLV").ClientTemplateId("template").TagName("div").Pageable()
        .HtmlAttributes(new { style = "width:400px;Height:400px;background-color:white;" })
 )


and this is my Controller

 public ActionResult ListView()
        {
            List<KendoModel> myList = new List<KendoModel>();
            for (int i = 1; i <= 100; i++)
                myList.Add(new KendoModel { ProductId = "PID" + i, ProductName = "name" + i, BrandName = "Brand" + i, Price = "Brand" + i });

            ViewBag.myList = myList;
            return View(myList);
        }

and i am attaching a file that shows the output of the code -

4 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 13 May 2013, 06:48 AM
Hello Akshay,

Can you please show us the code for the client template (ClientTemplateId("template"))? Also you can inspect the browser console for any JavaScript errors.

Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Akshay
Top achievements
Rank 1
answered on 13 May 2013, 11:11 AM
Thanks for your reply Nikolay Rusev i checked with browser console and I found following error "Uncaught TypeError: Cannot call method 'replace' of null " @kendo.all.min.js:9 could you please explain me what is that. and also there is no client Template defined in my project so can you give me the glimpse about it or any link that might be helpful? actually i only follow the documentation of kendo thats why i didn't declare any client Template. 
Thanks.
0
Accepted
Nikolay Rusev
Telerik team
answered on 14 May 2013, 06:41 AM
Hello Akshay,

The ListView widget doesn't have own rendering it depends on the what's inside the template. Thus you must to provide template for the ListView widget.

The 5th step in the ListView binding article shows how the template can be defined. You can also see the ASP.NET MVC source code for any of the widget demos by clicking the ASP.NET MVC tab in source preview section bellow each demo.

Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Akshay
Top achievements
Rank 1
answered on 14 May 2013, 07:43 AM
Thank you Nikolay Rusev. 
Now it is working.
Tags
ListView
Asked by
Akshay
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Akshay
Top achievements
Rank 1
Share this question
or