Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Web Development _ Telerik Kendo Grids

Posted by: LeeAnn May 1 2020, 01:44 PM

Maybe someone here can point me to the right direction, I have went to every other place. I am trying to work with a Teleriik Grid in an MVC application and I am seriously stuck. I have a grid that is set and looks beautiful but for one thing, I cannot for the life of me figure out how to get the data from the database to the view. The headers look really great but there is no data. I know that I need to get add something to the controller but I do not know what. Here is what I have in the view. I know I probably will not get any assistance on this from here but I have looked everywhere else and I have received information overload. So I am taking a long shot that maybe I can hey help:

    @Html.ActionLink("Create New", "Create")
            .Columns(columns =>
                columns.Bound(c => c.StatusID)
                columns.Bound(c => c.Status.NameofStatus)
                .Title("Status Name").Width(70);
                                //columns.Command(commands =>
                //    commands.Edit().Text(" ".).UpdateText(" ").CancelText(" ");
                //    commands.Destroy().Text(" ");


            .Filterable(ftb => ftb.Mode(GridFilterMode.Menu))
            .DataSource(dataSource =>
            .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"))


Posted by: ChromaticZero May 6 2020, 12:41 AM

Hi LeeAnn,

This is a bit difficult to troubleshoot without a deeper look at what's going on with the entire application, and there are a lot of areas that could be causing you problems. I suppose I would have several questions for you to start digging into this -

1. Is this the only grid you currently have hooked up in your application? I ask because if you have another grid and it's working, it would be a great place to look and determine where you might be going wrong.

2. Can you confirm that data is being passed between your database and your application with the controller? Essentially, your controller should be 'fetching' the data from your database and presenting it to your view. If it's not making it to the controller, that would be where I might start to troubleshoot the problem.

3. Judging by the code you've provided, it appears to me that your DataSource is lacking a proper Ajax call. The Ajax call should be where the GET request is sent. It would/should look something like this (example code only):

    type: "POST",
    URL: '@URL.Action("Search")',
    data: JSON.stringify({ id: id }),
    dataType: "json",
    contentType: "application/json; charset=utf-8",
    success: function (result) {
        var grid = $("#Grid").data("kendoGrid");
        var data = new;;

You should definitely be checking out the Telerik whitepages on how to hook this up properly in an MVC architecture. Unfortunately for you, the work I do with Kendo is MVVM so I'm unfamiliar with the proper syntax and hookup that you're looking for. Hopefully this will at least get you started in the right direction.

Posted by: LeeAnn May 8 2020, 09:11 AM

Thanks for your assistance. The issue I think is that in a grid you can only pull from one model (forgive me if that is incorrect but from what it looks to me that is what I am seeing). When I took the grid and just showed the fields from my main table the data came up fine. So now I am looking at trying to make dropdown list. When I create a dropdown list all I see is a bunch of blank text boxes unless I edit the record, then I see the numerical value of the record. I click update and sometimes it turns into a dropdown but then if you hit edit again it turns right back into a text box. I am not too happy with grids as it seems if I solve one issue another one comes up. I am getting too old to learn new stuff I feel, especially stuff that is so hard to work with. I do admit though the grids look good.....

Thanks again for the help.

Posted by: ChromaticZero May 27 2020, 11:40 AM

Hi LeeAnn,

I saw this after I sent you a PM in regards to the issue. This give a bit more context to what you're dealing with.

Again, I would recommend you check out the Telerik whitepapers on this ( but I might be able to help you get going in the right direction.
The grid will have it's own model to work with, this should be organized and passed via the controller. Likewise, the dropdown list will also require it's own DataSource in order to determine what values can be selected and which selected value should be saved to the field. Refer to the whitepaper to understand how that works.

In regards to the Edit issue, it may be that your grid is configured in a particular way that you don't find appealing and it may be that you want to configure it for Inline editing.
Here is an example for the MVC Grid :
Here is an example for editing Inline :

Without more information on what you're doing and what you're trying to achieve, I won't be able to help you. If you can post your code, I might be able to provide you more assistance.

Good luck!