unable to bind grid properly

Thread is closed for posting
4 posts, 0 answers
  1. Imteyaz
    Imteyaz avatar
    3 posts
    Member since:
    Oct 2011

    Posted 05 Jan 2013 Link to this post

    Hello I have a grid in my razor view,
    I have added these resources
    <link rel="stylesheet" href="@Url.Content("~/Content/KendoThemes/kendo.common.min.css")">
        <link rel="stylesheet" href="@Url.Content("~/Content/KendoThemes/kendo.rtl.min.css")">
        <link rel="stylesheet" href="@Url.Content("~/Content/KendoThemes/kendo.default.min.css")">
     
    <script src="@Url.Content("~/Scripts/jquery.min.js")"></script>
        <script src="@Url.Content("~/Scripts/kendo.web.min.js")"></script>
        <script src="@Url.Content("~/Scripts/kendo.aspnetmvc.min.js")"></script>


    here is my grid

      
    @(Html.Kendo().Grid<Nop.Web.Models.Customer.CustomerInfoModel>()
        .Name("Grid")   
        .Columns(columns => {       
            columns.Bound(p => p.Active);
           // columns.Bound(p => p.cbSubscriptions).ClientTemplate("#=Employee.EmployeeName#");
            columns.Bound(p => p.cbSubscriptions);
            columns.Bound(p => p.FirstName);
            columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);   
        })   
        .ToolBar(toolBar => toolBar.Create())
        .Editable(editable => editable.Mode(GridEditMode.InLine))
        .Pageable()
        .Sortable()
        .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .Events(events => events.Error("error_handler"))
                    .Model(model => model.Id(p => p.Id))
                            .Create(update => update.Action("EditingInline_Create", "Customer"))
                            .Read(read => read.Action("UsersList", "Customer"))
                    .Update(update => update.Action("EditingInline_Update", "Grid"))
                    .Destroy(update => update.Action("EditingInline_Destroy", "Grid"))
                )
    )
    <script type="text/javascript">
        function error_handler(e) {
            if (e.errors) {
                var message = "Errors:\n";
                $.each(e.errors, function (key, value) {
                    if ('errors' in value) {
                        $.each(value.errors, function () {
                            message += this + "\n";
                        });
                    }
                });
                alert(message);
            }
        }
    </script>

    This works fine. it calls my action in controller to read the data, but the problem is that, it is displaying any rows in grid, even the controller returns the record. I have checked the console, there is no script error, and my network tab shows that these data has been transferred from the server. 

    1. data[{Email:familymanager1_user1@gmail.com, AllowUsersToChangeUsernames:false, UsernamesEnabled:false,…},…]
      1. 0{Email:familymanager1_user1@gmail.com, AllowUsersToChangeUsernames:false, UsernamesEnabled:false,…}
      2. 1{Email:familymanager1_user2@gmail.com, AllowUsersToChangeUsernames:false, UsernamesEnabled:false,…}
      3. 2{Email:familymanager1_user3@gmail.com, AllowUsersToChangeUsernames:false, UsernamesEnabled:false,…}
      4. 3{Email:as@sad.com, AllowUsersToChangeUsernames:false, UsernamesEnabled:false, Username:aasasasasas687,…}
    2. total4

    Am I missing something to add. 
  2. Rosen
    Admin
    Rosen avatar
    3237 posts

    Posted 07 Jan 2013 Link to this post

    Hello Imteyaz,

    Looking at the format of the JSON response, it suspect that the controller action implementation is not correct. Please refer to this help article which describes how to populate the KendoUI Grid for ASP.NET MVC via AJAX and verify that your action uses the same approach.

    Regards,
    Rosen
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. srilatha
    srilatha avatar
    1 posts
    Member since:
    Aug 2016

    Posted 31 Aug Link to this post

    Unable to bind grid properly, can you please help me , it's very urgent
  5. Rosen
    Admin
    Rosen avatar
    3237 posts

    Posted 31 Aug Link to this post

    Hello srilatha,

    Looking at the provided information. I'm not sure neither what the problem is nor how the widget is configured. Please open a separate support request in which provide as much details as possible about your scenario, the behavior you are experiencing, the expected result and if possible a small runnable sample which to demonstrate it locally. 

    Regards,
    Rosen
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET MVC is VS 2017 Ready