X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Telerik Kendo Grids    
post May 1 2020, 01:44 PM

Posts: 1,303
Joined: 2-February 00
From: Mississippi USA Central Time Zone

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"))


This post has been edited by LeeAnn: May 1 2020, 01:46 PM

Lee Ann Davidson
Go to the top of the page
post May 6 2020, 12:41 AM

Posts: 26
Joined: 7-September 15

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 kendo.data.DataSource(result);

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.
Go to the top of the page
post May 8 2020, 09:11 AM

Posts: 1,303
Joined: 2-February 00
From: Mississippi USA Central Time Zone

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.

Lee Ann Davidson
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    26th May 2020 - 07:56 AM