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

Kendu Grid

8 Answers 134 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Christine
Top achievements
Rank 1
Veteran
Christine asked on 01 May 2020, 05:55 PM

I am new to MVC and really new to using the Telerik tools.  I have a grid made in my HTML and the headers come up and no data.  I would like to get the data to show up in the Grid.  I am sure I need to add something to the controller, just do not know what.  I have looked all over and I am getting information overload.  Here is what I have in my grid, what do I need in my controller?:

 

@(Html.Kendo().Grid<CertificateTrackingSystem.Models.Status>
()
.Name("StatusGrid")
.Columns(columns =>
{
columns.Bound(c => c.statusID)
.Visible(false).IncludeInMenu(true)
.Title("ID").Width(30);
columns.Bound(c => c.NameofStatus)
.Title("Status Name").Width(70);
//columns.Command(commands =>
//{
// commands.Edit().Text(" ".).UpdateText(" ").CancelText(" ");
// commands.Destroy().Text(" ");
//}).Title("Actions").Width(150);
}
)
.Filterable(ftb => ftb.Mode(GridFilterMode.Menu))
.DataSource(dataSource =>
dataSource.Ajax()
.Sort(sort => sort.Add("Status").Descending())
.Model(model =>
{
model.Id(Status => Status.statusID);
model.Field(Status => Status.NameofStatus).Editable(false);
}
)
)//.Events(e => e.sync("sync_handler"))
// .Create(create => create.Action("AddComments", "Document", new { areas = "Document", docID = @documentID, docRev = @documentRev }).Data("GetRequestToken"))
// .Read(read => read.Action("ReadComments", "Document", new { areas = "Document", documentID = @documentID, documentRev = @documentRev }).Type(HttpVerbs.Get))
// .Update(update => update.Action("UpdateComments", "Document",new { areas = "Document" }).Data("GetRequestToken"))
// .Destroy(destroy => destroy.Action("DeleteComments", "Document", new { areas = "Document"}).Data("GetRequestToken"))
// .PageSize(5)
// .ServerOperation(false)//.Pageable(x => x.PageSizes(new List<object> { 5, 10, 20, 50, "all" }).Refresh(true))
//.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("Comments"))
//.Sortable()

)

 

 

 

 

 

8 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 05 May 2020, 11:52 AM

Hello Christine,

I would suggest you read the following Ajax binding article. It demonstrates step by step how to configure the Grid HtmlHelper extension for Ajax binding.

Additionally, I am attaching a small MVC demo project implementing a Grid that supports editing, filtering, sorting functionalities. There you can find how the CRUD operations are configured. Please examine it and let me know if you have any questions.

Regards,
Nikolay
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Christine
Top achievements
Rank 1
Veteran
answered on 05 May 2020, 07:55 PM
Thanks, I will take a look.  I do have some grids working.  I thin the issue I am having with one particular grid is that the data has about 13 fields and it is going off the page (No problem there as I can scroll) but it looks like the data area is not the same size therefore maybe it is not showing the data?????  I have looked at this particular grid until I am blue in the face.  No matter what I do the data refuses to display,  Everything is set up like the other Grids but this one is frustrating me to ne end.
0
Christine
Top achievements
Rank 1
Veteran
answered on 05 May 2020, 08:05 PM

 

OK sorry if I sound frustrated here but it has been a long day.  I have three Grids that are acting great.  One grid I have set up has about 15 fields and is scrolling off the page.  It looks like the area data is displayed is not as big as the headers,  Could that be a reason that the data is not displaying?  I have it set up like the other grids that are displaying data.  I have included a picture and you can see the headers are off the page but what looks to be a table that will hold the data is not as big as the headers.

I will take a look at your application you zipped up and maybe it will help with other things down the road. 

 

 

0
Christine
Top achievements
Rank 1
Veteran
answered on 06 May 2020, 03:34 PM

The demo really helped me get started on the CRUD operations.  I have one grid completely done for one of my screens and it looks good.  The one thing I am wondering is when you want to do a search, is there a to  put something like a little icon that a person see and click on to show the search screen.  I did not really know where to click until I played  with it some.

 

Also my main Grid is still having issues.  The header shows up but still no data is displaying.  I even went and deleted the grid  and recreated it with no luck.  So I do not know what I need to do to get the data to show, it really has me scratching me head.

0
Nikolay
Telerik team
answered on 07 May 2020, 11:15 AM

Hello Christine,

By saying "do a search" are you referring to the Search Panel functionality or the Filter one? Both of them have icons suggesting to the user that they can search or filter.

Regarding the Grid data not showing, it is hard to tell what might be causing this behavior without having the Grid declaration. Are there any JavaScript errors in the console? Is the data returned correctly for the controller (read method)? This can be found in the Network tab in DevTools:

Looking forward to your reply.

Regards,


Nikolay
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Christine
Top achievements
Rank 1
Veteran
answered on 07 May 2020, 02:27 PM
I think what my issue is that the Grid has data from two different tables.  I need a way to implement a drop down in the Grid.  I have tried to look around the Internet and I have yet found a site that clearly shows how to implement the drop down in both the View and the Control.  I am still looking.  I really need something very easy to understand as I am new to this type of developing.  I had thought that the data would be displayed in a test box and not be editable.  Once I took the external fields out I was able to see the Certificate fields.  Am I right in that assumption, you cannot have fields that are in another table (or model) in a Grid, they can only come from one table?
0
Christine
Top achievements
Rank 1
Veteran
answered on 08 May 2020, 03:14 PM
Different route.  How can I have a Grid display fields in separate tables, no drop downs, just display?  I have a Certificate Table that has a ServerID that I can link to a Server table that has a server name that I need displayed?  There has to be a way to do that?
0
Christine
Top achievements
Rank 1
Veteran
answered on 08 May 2020, 07:50 PM
Solved my problem.  I used a View Model as my source for the Grid and now I can see everything.  Thanks for the help!  I will be asking another question in the forum in a few minutes.
Tags
General Discussions
Asked by
Christine
Top achievements
Rank 1
Veteran
Answers by
Nikolay
Telerik team
Christine
Top achievements
Rank 1
Veteran
Share this question
or