Kendo Grid not showing data due to particular column

7 posts, 1 answers
  1. Jack
    Jack avatar
    67 posts
    Member since:
    Jul 2010

    Posted 22 Aug 2013 Link to this post

    Hi to all, i am facing one problem while binding my json data to Kendo grid

    I have 7 columns in  database . I ma fetching 5 columns and sending data through json and binding Kendo Grid,
    but when passing those 6th or 7th column Kendo grid not showing anything as its coming in json result.

    Please help as i don't know what to do with this

    @(Html.Kendo().Grid(Model)  
        .Name("Grid")
         .Columns(columns =>
          {        
              
              columns.Bound(model => model.FirstName).Width(150);
              columns.Bound(model => model.LastName).Width(150);         
              columns.Bound(model => model.EmailAddress).Width(150).Sortable(false);        
              columns.Bound(model => model.IsActive).Width(100);
              columns.Bound(model => model.LoginName).Width(100).Visible(false);
              //columns.Bound(model => model.Address).Width(100).Visible(false);
              // Add "Edit" and "Destroy" commands
              columns.Command(command => { command.Edit(); }).Width(100);
             
          })
       .Pageable(pageable => pageable.ButtonCount(5))
      
        .Sortable(sort => sort.Enabled(true))
        .Filterable()
        .Scrollable()
        .Groupable()
        // Add "Create" command
        .ToolBar(commands => commands.Create())
         // Set the edit mode to "PopPup"
        .Editable(editable => editable.Mode(GridEditMode.PopUp))
        .HtmlAttributes(new { style = "height:430px;" })
        .DataSource(dataSource => dataSource
            
              
                .Ajax()
                .PageSize(50)
                .ServerOperation(false)
                .Model(model => model.Id(p => p.ID))
                
                .Create("InsertUser","ProductKendo")
                .Update("UpdateUser","ProductKendo")
                 .Destroy("DeleteUser","ProductKendo")
                
            
            .Read(read => read.Action("GetUserDataKendo", "ProductKendo")
               
            
            )
        ) .Resizable(resize => resize.Columns(true))
        
        
    )

    when i send address field,grid doesn't show anything

    Thanks
  2. iCognition
    iCognition avatar
    66 posts
    Member since:
    Apr 2012

    Posted 22 Aug 2013 Link to this post

    Is the model.Address a string? If it isn't, you may have to do something like this:

    columns.Bound(model => model.Address).Width(100).Visible(false).ClientTemplate("#= Address.StringVariableName #");
  3. Jack
    Jack avatar
    67 posts
    Member since:
    Jul 2010

    Posted 22 Aug 2013 Link to this post

    Hi Matt,thanks for answering

    This becomes a very strange problem to me. from my sp i am returning like

    declare @NewTable as table(ID bigint,
       LoginName nvarchar(500),
       Password nvarchar(200),
       FirstName nvarchar(50),
       MiddleName nvarchar(500),
       LastName nvarchar(500),
       UserPicture Image,
       Address nvarchar(1500),
       City nvarchar(100),
       State nvarchar(100),
       MobileNo nvarchar(50),
       LandLineNo nvarchar(100),
       EmailAddress nvarchar(50),
       DateOfBirth nvarchar(50),
       IsActive bit,
       Country nvarchar(100));
    Insert @NewTable EXEC(@Query)
    select ID,LoginName,Password,FirstName,MiddleName,LastName,UserPicture,Address,City,IsActive from @NewTable


    Previously Addresss column written in last so Kendo Grid was showing blank but when i move it in between the Kendo Grid Showing data with adress column as well as.
    Now whats happening that due to IsActive column Kendo Grid not showing when i removed IsActive column Kendo grid showing data.

    when i adjust IsActive column in between LastName,Middlename  or so on... in my Query then Kendo Grid shows data.
    so i believe that data type is not a matter.
    This is becoming very tough for me that what actually creating the problem.

    I am attaching my view code Please see that
    Thanks




  4. Answer
    Daniel
    Admin
    Daniel avatar
    2214 posts

    Posted 26 Aug 2013 Link to this post

    Hello,

    The code does not indicate what is causing the issue. Could you check what is the response from the server? If should indicate what exactly is going wrong. 
    A possible reason for the problem when including additional columns is that the response length exceeds the maximum JSON length which will cause an exception. If that is the case then you can avoid the exception by using the approach demonstrated in this documentation topic.

    Regards,
    Daniel
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Jack
    Jack avatar
    67 posts
    Member since:
    Jul 2010

    Posted 27 Aug 2013 Link to this post

    Its the fifth day today when i loose hope to solve this problem
    but you, a kind person gave me a amazing solution and it works great .
    Thanks Daniel.i really appreciate for this help.

    And one thing to ask other than this,that why i get a very late reply
    from here whether its due to my demo account or anything else..
  6. Daniel
    Admin
    Daniel avatar
    2214 posts

    Posted 28 Aug 2013 Link to this post

    Hello,

    The reason is not due to the account. The response time for forum threads is 48 hours considering work days only.

    Regards,
    Daniel
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  7. Jack
    Jack avatar
    67 posts
    Member since:
    Jul 2010

    Posted 29 Aug 2013 Link to this post

    Hi Daniel,
    Thanks for giving valuable Information.
Back to Top