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

[Solved] Grid Appends RouteData to Ajax actions

0 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.
Simon Hazelton
Top achievements
Rank 1
Simon Hazelton asked on 18 Jul 2010, 12:11 PM
Hi

I'm trying to use the telrik mvc grid wit ajax databinding in a portal environment.

I have a grid with ajax binding methods

[GridAction(EnableCustomBinding = true)]
        public ActionResult _GetCategoriesGrid()
        {
            return View(GetCategoryGridModel());
        }
 
        private GridModel GetCategoryGridModel()
        {
            CategoryProcess process = new CategoryProcess();
            int totalRecords = 0;
            int pageIndex = 0;
            int pageSize = 10;
            Int32.TryParse(Request.Form["page"], out pageIndex);
            Int32.TryParse(Request.Form["size"], out pageSize);
            GridModel model = new GridModel();
            model.Data = process.GetCategoriesWithCharities(pageIndex == 0 ? pageIndex : pageIndex - 1, pageSize, out totalRecords);
            model.Total = totalRecords;
            return model;
        }

Somehow the links for paging are including some route information.

http://localhost:54337/Charity/_GetCharitiesGrid?Instance=MC.Entities.Personalization.WidgetInstance&IsEditing=False&filter=&groupBy=&orderBy=&page=2&size=10

My grid looks like this

<%= Html.Telerik().Grid<MC.Entities.Charities.Charity>()
        .Name("Charities")
        .DataKeys(keys => keys.Add(k => k.CharityId))
        .Columns(columns =>
        {
            columns.Bound(o => o.Name).Width(250)
                .ClientTemplate("<a href='/Charity/View/<#= CharityId #>/<#= HtmlCharityName #>' title='<#= Name #>'><#= Name #></a>");
            columns.Bound(o => o.Address.County).Width(150);
            columns.Bound(o => o.Address.Town).Width(100);
        })
        .DataBinding(dataBinding => dataBinding.Ajax().Select("_GetCharitiesGrid", "Charity"))
        .Pageable()
        .Sortable()
        .Filterable()
         
    %>

Is there any way of removing the Instance and IsEditing post variables?
Tags
Grid
Asked by
Simon Hazelton
Top achievements
Rank 1
Share this question
or