Help with Listview READ action not fired in umbraco7 MVC

7 posts, 0 answers
  1. Pierre
    Pierre avatar
    212 posts
    Member since:
    Apr 2007

    Posted 07 Nov 2014 Link to this post

    Hi, i try several thing to make my listview working without success. I do not see any error in console, but the initial "get" request not fired. I can't see where a make a mistake..

    My js definition:
    <script src="~/LibsExt/jquery-1.11.0.min.js"></script>
    <script src="~/LibsExt/bootstrap.min.js"></script>
    <script src="~/LibsExt/kendo.web.min.js"></script>
    <script src="~/LibsExt/kendo.aspnetmvc.min.js"></script>

    My Controler (in the action function I do nothing for now. I just when to test if my breakpoint will be hit.
    public ActionResult Produits_Read([DataSourceRequest] DataSourceRequest request)
    {
        int i = 0;
        return Json("");
    }

    my model
    public class ProduitModel
    {
        public int id { get; set; }
        public string Nom { get; set; }
        public string urlThumb { get; set; }
        public string urlImage { get; set; }
        public string descCourte { get; set; }
        public IHtmlString contenu { get; set; }
        public decimal prix { get; set; }
    }

    Then my view
    @(Html.Kendo().ListView<ProduitModel>(@Model.produits)
        .Name("listView")
        .TagName("div")
        .ClientTemplateId("produitTemp")
        .DataSource(dataSource => {
            dataSource.Read(read => read.Action("Produits_Read","CategoriesController").Type(HttpVerbs.Get));
            dataSource.PageSize(15);
        })
        .Pageable()
        .BindTo((IEnumerable<ProduitModel>)ViewData["listView"])
    )

    I try with or without the .BindTo command with same result.
    What are missing?
    I am running in umbraco7 MVC 4 environnement. meaby is the point? Need to add something there in routing or config?
    Thanks a lot
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 11 Nov 2014 Link to this post

    Hello Pierre-Dominique,

    I can see that you are binding your ListView in a few places. Please test the following configuration:

    @(Html.Kendo().ListView<ProduitModel>()
        .Name("listView")
        .TagName("div")
        .ClientTemplateId("produitTemp")
        .DataSource(dataSource => {
            dataSource.Read(read => read.Action("Produits_Read","CategoriesController"));
            dataSource.PageSize(15);
        })
        .Pageable()
    )

    If this does not help please examine for any JavaScript errors in the console, as it might be another cause for issues.

    Regards,
    Kiril Nikolov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Pierre
    Pierre avatar
    212 posts
    Member since:
    Apr 2007

    Posted 26 Nov 2014 in reply to Kiril Nikolov Link to this post

    Sory for late reply. I try your code. Same result. I can't see any error in cosole...
  5. Pierre
    Pierre avatar
    212 posts
    Member since:
    Apr 2007

    Posted 26 Nov 2014 in reply to Pierre Link to this post

    And i see no server call in the network console of chrome.
  6. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 27 Nov 2014 Link to this post

    Hello Pierre-Dominique,

    Can you please send us an example that shows your exact setup so we can run it locally and narrow down the issue?

    Thanks for the cooperation.

    Regards,
    Kiril Nikolov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. Pierre
    Pierre avatar
    212 posts
    Member since:
    Apr 2007

    Posted 02 Dec 2014 in reply to Kiril Nikolov Link to this post

    Hi, i Just try to start with the Telerik MVC Template, than add the listview in the About page, add the Template, add the model and add the action code in the HomeController.
    No error, but then action code not fired. I am new to MVC programmaing, I am shure i do something wrong. If you can point it to me?
    Thanks a lot
    I can't attache the file (more than 2 Meg).

    Here what I do:
    1- Create an empty Telerik MVC app (MVC5)
    2- Add this in the about view
    <aside>
        <h3>Telerik UI for ASP.NET MVC TreeView</h3>
        <p>
            Use this area to provide additional information.
        </p>
     
        <div class="ListeProduits">
            @(Html.Kendo().ListView<TelerikMvcApp1.Models.ProduitModel>()
            .Name("listView")
            .TagName("div")
            .ClientTemplateId("produitTemp")
            .DataSource(dataSource =>
            {
     
                dataSource.Read(read => read.Action("Produits_Read", "HomeController"));
     
                dataSource.PageSize(15);
     
            })
            .Pageable()
            )
        </div>
     
        @(Html.Kendo().TreeView()
            .Name("LinksTreeView")
            .Items(items =>
            {
                items.Add()
                    .Text("Home")
                    .Action("Index", "Home");
                items.Add()
                    .Text("About")
                    .Action("About", "Home");
                items.Add()
                    .Text("Contact")
                    .Action("Contact", "Home");
            })
        )
     
    </aside>

    3- add this model
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
     
    namespace TelerikMvcApp1.Models
    {
        public class ProduitModel
        {
            public int id { get; set; }
            public string Nom { get; set; }
            public string urlThumb { get; set; }
            public string urlImage { get; set; }
            public string descCourte { get; set; }
            public IHtmlString contenu { get; set; }
            public decimal prix { get; set; }
        }
    }

    4- Add this in the HomeControler
    public ActionResult Produits_Read([DataSourceRequest] DataSourceRequest request)
    {
        int i = 0;
        return Json("");
    }

    5- Breakpoint on the int i = 0; never fired.
    Thanks
  8. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 03 Dec 2014 Link to this post

    Hello Pierre-Dominique,

    Please make sure that you do not have any JavaScript errors in the console, and the template is correctly compiled, if you have error in the ClientTempalte (can be seen in the console of your Chrome dev tools) no request will be made. Other possible reason is missing kendo.aspnetmvc.min.js file, please make sure that it is included in the project.

    If this does not help, send us the sample, so we can investigate the issue.

    Regards,
    Kiril Nikolov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready