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

5 posts, 1 answers
  1. Akshay
    Akshay avatar
    3 posts
    Member since:
    Apr 2013

    Posted 10 May 2013 Link to this post

    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 -
  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 13 May 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Akshay
    Akshay avatar
    3 posts
    Member since:
    Apr 2013

    Posted 13 May 2013 Link to this post

    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.
  5. Answer
    Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 14 May 2013 Link to this post

    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!
  6. Akshay
    Akshay avatar
    3 posts
    Member since:
    Apr 2013

    Posted 14 May 2013 Link to this post

    Thank you Nikolay Rusev. 
    Now it is working.
Back to Top
Kendo UI is VS 2017 Ready