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

[Solved] 404 returned on Grid Events

5 Answers 82 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.
Mike
Top achievements
Rank 1
Mike asked on 09 Jun 2011, 08:47 PM
I am using a Grid with sorting and paging.  If I click on a column to sort or to switch pages I get a popup that says "Error! The requested URL returned 404 - error".  If I were to click the column to sort it has the link: http://localhost:10849/Liaisons/Grid?orderBy=COMPANY_GROUP-asc.  If I had a slash after the action and change it to: http://localhost:10849/Liaisons/Grid/?orderBy=COMPANY_GROUP-asc it works just fine.  Same thing with paging, http://localhost:10849/Liaisons/Grid?page=3 does not work but http://localhost:10849/Liaisons/Grid/?page=3 does work.  It sound like a routing issue but not sure if there is something else happening.  Here is my RegisterRoutes:
public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    routes.MapRoute(
        "Default",
        "{controller}/{action}/{id}",
        new {controller = "Home", action = "Index", id = UrlParameter.Optional }
    );
}

5 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 10 Jun 2011, 07:35 AM
Hi Mike Parzygnat,

 It looks as if your grid is not properly configured. 404 errors occur when the URLs requested by the grid and defined via the DataBinding configuration do not exist. Also check if your page contains a ScriptRegistrar. The latter is vital for the proper operation of the grid in ajax bound mode. 

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
Mike
Top achievements
Rank 1
answered on 10 Jun 2011, 01:28 PM
I have a ScriptRegistrar on my Master Page and by checking Fiddler, I see that the Telerik scripts and css files are loaded.  I am using the 2011.1.315 MVC 3 controls.  The grid is defined as:
<% Html.Telerik().Grid(Model) 
    .Name("grdLiaisons") 
    .DataKeys(dataKeys => dataKeys.Add(key => key.COMPANY_ID)) 
    .NoRecordsTemplate("No Liaisons could be retrieved from the database") 
    .Columns(columns => 
        { 
            columns.Bound(a => a.COMPANY_NAME); 
            columns.Bound(a => a.COMPANY_ABBREV); 
            columns.Bound(a => a.COMPANY_GROUP); 
            columns.Bound(a => a.COMPANY_LIAISON); 
            columns.Bound(a => a.COMPANY_GM); 
            columns.Bound(a => a.COMPANY_CONTROLLER); 
            columns.Bound(a => a.COMPANY_BA); 
            columns.Bound(a => a.COMPANY_EMAIL); 
        }) 
    .DataBinding(dataBinding => 
    { 
        dataBinding.Ajax().Select("_Grid", "grdLiaisons"); 
    }) 
    .Scrollable() 
    .Sortable() 
    .Pageable() 
    .Filterable() 
    .Groupable() 
    .Footer(true) 
    .Render(); 
%>

In the controller _Grid is defined as:
[Telerik.Web.Mvc.GridAction]
public ActionResult _Grid()
{
    return View(new Telerik.Web.Mvc.GridModel(db.SP_GET_LIAISONS()));
}

Grid is defined as:
public ActionResult Grid()
{
    return View(db.SP_GET_LIAISONS());
}

The grid displays properly and works as long as the slash "/" in inserted after the action "Grid" in the URL generated by the control.
0
Atanas Korchev
Telerik team
answered on 10 Jun 2011, 02:35 PM
Hi Mike,

 I cannot reproduce this locally and in our online demos. I am afraid I cannot help unless you provide a sample project demonstrating the problem.

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
Mike
Top achievements
Rank 1
answered on 10 Jun 2011, 03:27 PM
Attached is a sample project that duplicates this behavior.  Once the application is running and on the grid page, clicking on a column to sort produces the 404 error.  If you right click on the column and select, Copy shortcut, then paste it in the address bar and put a slash / before the question mark then it works.
0
Accepted
Atanas Korchev
Telerik team
answered on 10 Jun 2011, 03:48 PM
Hello Mike,

 There is no controller called "grdLiaisons" hence the problem:

dataBinding.Ajax().Select("_Grid", "grdLiaisons");

Change that to

dataBinding.Ajax().Select("_Grid", "Liaisons");

as you controller is named LiaisonsController

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
Tags
Grid
Asked by
Mike
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Mike
Top achievements
Rank 1
Share this question
or