2

I've created a page which support editing multiple entities.
This page is called like: http://localhost/Personnel/EditMultiple?id=2944&id=7

On this page there is a GridView which should list these personnels in a grid. This grid is defined like:

<% Html.Telerik().Grid<Web.Models.PersonnelMiniVM>()
    .Columns(columns =>
    {
        columns.Bound(p => p.Name);
    })
    .DataBinding(d => d.Ajax().Select("_GetPersonnelByIds", "Personnel", new { personnelIds = string.Join(",", Model.PersonnelIds) }))
    .Pageable(page => page.PageTo(Model.Page))
    .Sortable(sorting => sorting.OrderBy(sortOrder => sortOrder.Add(p => p.Name)))
    .Render();
%>

But when I look at the URL which is posted to the Personnel Controller, it's like:

http://localhost/Personnel/_GetPersonnelByIds/2944%2c7?personnelIds=7%2C2944&Personnel-size=5

What I don't understand is that why the 2944%2c7 is appended and this also gives me an 401 error when the URL gets too long.

The routing defined in Global.asax is like this:

routes.MapRoute(
    "Default",
    "{controller}/{action}/{id}",
    new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);

How to solve this ?

1 Answer 1

3

See this :

http://www.telerik.com/community/forums/aspnet-mvc/grid/mvc3-grid-control-ajax-bound-select-url-has-extra-route-values.aspx

Solution is to clear the id, like:

.DataBinding(d => d.Ajax().Select("_GetPersonnelByIds", "Personnel", new { id= "", personnelIds = string.Join(",", Model.PersonnelIds) }))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.