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

Kendo Grid not showing data due to particular column

6 Answers 418 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jack
Top achievements
Rank 1
Jack asked on 22 Aug 2013, 12:11 PM
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

6 Answers, 1 is accepted

Sort by
0
iCognition
Top achievements
Rank 1
answered on 23 Aug 2013, 02:42 AM
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 #");
0
Jack
Top achievements
Rank 1
answered on 23 Aug 2013, 04:27 AM
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




0
Accepted
Daniel
Telerik team
answered on 26 Aug 2013, 12:19 PM
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!
0
Jack
Top achievements
Rank 1
answered on 27 Aug 2013, 05:17 AM
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..
0
Daniel
Telerik team
answered on 28 Aug 2013, 05:32 PM
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!
0
Jack
Top achievements
Rank 1
answered on 29 Aug 2013, 12:06 PM
Hi Daniel,
Thanks for giving valuable Information.
Tags
Grid
Asked by
Jack
Top achievements
Rank 1
Answers by
iCognition
Top achievements
Rank 1
Jack
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or