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

Ajax Grid issue.

6 Answers 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chris
Top achievements
Rank 1
Chris asked on 03 Aug 2010, 03:50 AM
I am trying to add a delete button to my ajax grid and it is not working.

Here is the grid:
<%= Html.Telerik().Grid<ProgramNoteDisplay>().Name("Grid")
    .DataKeys(keys => { keys.Add(p =>  p.FileProgramNotesID); })
    .DataBinding(dataBinding => { dataBinding.Ajax()
        .Select("Test2","ShortSale")
        .Delete("_TestDelete2", "ShortSale", new {FileID=ViewData["FileID"]});
    })
    .Columns(columns =>
                 {
                     columns.Bound(p => p.FileProgramNotesID); 
                     columns.Bound(p => p.NoteType).Width(130); 
                     columns.Bound(p => p.NoteAddtional).Width(130); 
                     columns.Command(commands => { commands.Delete(); }).Width(180).Title("Commands");
                 }).Editable(ed=>ed.Enabled(true))
%>

The controller:
[GridAction]
      public ActionResult Test2(int id)
      {
          ViewData.Add("FileID", id);
          return View(new GridModel(ProgramNote(id)));
      }
      [AcceptVerbs(HttpVerbs.Post)]
      [GridAction]
      public ActionResult _TestDelete2(int id, string FileID)
      {
          //Delete Record
          return View(new GridModel(ProgramNote(Convert.ToInt32(FileID))));
      }

The grid renders fine.  The delete command shows up but only has a href="#" and doesnt fire the controller.

Any ideas?  What am I doing wrong? The non-ajax implementation works fine.

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 03 Aug 2010, 07:03 AM
Hello Chris,

It could be a case of "client-side features do not-work". Please check the troubleshooting help topic.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Chris
Top achievements
Rank 1
answered on 03 Aug 2010, 07:55 AM
Thanks for the quick reply.  I had the ScriptRegistrar and it is registering all the scripts.  I have tried pulling it out of the master page.
The grid hits the .Select method fine and I can refresh the grid, the buttons do not work.  I am using version 2010.2.713.

Any more ideas?

Thank you
0
Atanas Korchev
Telerik team
answered on 03 Aug 2010, 08:07 AM
Hello Chris,

This may be due to a bug caused by jquery.validate.js. You can check that out and if this is the case use the updated file from the 713 release. If not please provide a sample project demonstrating your setup.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Chris
Top achievements
Rank 1
answered on 03 Aug 2010, 08:55 AM
That worked!  Thank you very much.
0
murali
Top achievements
Rank 1
answered on 06 Aug 2010, 02:39 PM
Hello Atanas,

I am having an issue with the Ajax grid along the same lines, since I updated to 2010.2.713. This is what I am experiencing.

1. When I click on the refresh button it would resubmit the entire page
2. The page numbers are disabled.
3. But the page next button and last button are good, but when I click on them it does the same thing it resubmits the entire page.

I have to two grids on the same page, like master and detail grid, but my bottom grid is on a telerik tab, and also on the same page I have another grid that will display on a dialog. All these are ajax grids and loaded on demand from partial views.

All my scripts are registered properly, I even copied the jquery files from 713, but still having the same issue.

Any kind of help is greatly appreciated

Thank you,
mk


0
murali
Top achievements
Rank 1
answered on 09 Aug 2010, 11:12 PM
I tried to isolate the issue, so I created a brand new project with Northwind database, and tried to start with Customer and Orders grids.
When I first ran the project, I was able to duplicate the issue, as the grid was not doing the ajax call but it resubmits the entire page, but after a while everything seems to be working normally, not sure what I did to make it work back again. I was hoping someone would shed some light on the issue.

When I try to traverse to the next page on the grid, this gets attached at the end of the url "?Customers-page=2" (Customers is my grid name.)

Did anyone see this before, rest of the grid settings are the defaults.
    
<%= Html.Telerik().Grid((IEnumerable<TelerikMvcApplication1.Models.Customer>)ViewData["Customers"])
        .Name("Customers")
        .DataKeys(dataKeys =>
        {
            dataKeys.Add(g => g.CustomerID).RouteKey("id");
        })
        .Columns(columns =>
        {
            columns.Bound(g => g.CustomerID).Hidden(true);
            columns.Bound(g => g.CompanyName);
            columns.Bound(g => g.ContactName)
                .Width("25%");
                //.HtmlAttributes(new { style = "width:25%" });
            columns.Bound(g => g.ContactTitle)
                .Width("25%");
                //.HtmlAttributes(new { style = "width:25%" });
            columns.Bound(g => g.Address)
                .ReadOnly()
                .Width("25%");
                //.HtmlAttributes(new { style = "width:25%" });
        })
        .DataBinding(dataBinding =>
        {
            dataBinding.Ajax()
                .Select("GetCustomers", "Home");
        })
        .Pageable(paging => paging.PageSize(5))
        .Sortable()
        .Selectable()
        .RowAction(row =>
        {
            row.Selected = row.DataItem.CustomerID.Equals(ViewData["id"]);
        })
%>

Thank you,
mm
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Chris
Top achievements
Rank 1
murali
Top achievements
Rank 1
Share this question
or