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

How can I get PageSizeDropDown to function with CustomBinding?

3 Answers 46 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.
Stefan
Top achievements
Rank 1
Stefan asked on 25 May 2011, 12:20 PM
Hi,

I can't figure out how to get PageSizeDropDown to function with CustomBinding?
Whatever I select in the dropdown it is always the current Grid-size that is returned.
Is it even possible to use the PageSizeDropDown with CustomBinding?
Any advice on this would be appriciated.

Regards
Stefan

3 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 26 May 2011, 07:14 AM
Hi Stefan,

I'm afraid that I'm not sure want may caused the described behavior as I'm unable to recreate it locally. Therefore, could you please provide a small runnable sample in which it can be observed?

All the best,
Rosen
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
Stefan
Top achievements
Rank 1
answered on 30 May 2011, 12:41 PM
Hello again, sorry for the late answer but I'm involved in 2 projects at the time so I have a hard time keeping up.

I've been struggling some more with this, as it should be doable according to your answer, but without any success. I'm still only get the selected gridsize when selecting another.
Maybe it has someting to do with the way I'm trying to use the QueryString-paramters?
I'm providing some code indicating what I'm trying to achieve. The real application is communicating with a WCF-service which is returning the GridResult-object containing the grid-data and total amount of records.

Regards Stefan

public ActionResult SiteEvents()
        {
            var gridSize = Convert.ToInt32(Request.QueryString["Grid-size"]);
            //if (gridSize == 0) gridSize = 11;
  
            var siteEvent = new SiteEvent
                                {
                                    Code = "1-2-3",
                                    UtcTime = DateTime.UtcNow,
                                    LogLevel = 4,
                                    LogLevelName = "Critical",
                                    SiteName = "Site name",
                                    SiteId = 1,
                                    PackageName = "Package name",
                                    Information = "Info..."
                                };
  
            var siteEvents = new List<SiteEvent>();
            var total = 30;
  
            for (var i = 1; i <= gridSize; i++) {
                siteEvents.Add(siteEvent);
            }
  
            var viewData = new SiteEventGridModel
                               {
                                   EntityId = 1,
                                   NumberOfSiteEvents = "100",
                                   ControllerName = "Home",
                                   GridPage = 1,
                                   GridSize = gridSize,
                                   //GridSizes = new [] {6, 11, 16, 26},
                                   ActionResponse = new SiteEventActionResponse {ActionStatus = SiteEventActionStatus.Success, Message = string.Empty},
                                   GridResult = new GridResult {Data = siteEvents, Resolved = 7, Total = total},
                                     
                               };
  
            return View(viewData);
        }


<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<
MvcApplication1.ViewModels.SiteEventGridModel>" %>
<%@ Import Namespace="MvcApplication1.Models" %>
  
<%  Html.Telerik().Grid<SiteEvent>()
    .Name("Grid")
    .EnableCustomBinding(true)
    .BindTo(Model.GridResult.Data)
    .DataKeys(dataKeys => dataKeys.Add(model => model.Id))
    .Columns(columns => {
        columns.Bound(model => model.LogLevelName);
        columns.Bound(model => model.SiteName);
        columns.Bound(model => model.UtcTime);
        columns.Bound(model => model.PackageName);
        columns.Bound(model => model.Code);
        columns.Bound(model => model.Information);
    })
    .Filterable()
    .Footer(true)
    //.Pageable(paging => paging.Style(GridPagerStyles.PageSizeDropDown | GridPagerStyles.NextPreviousAndNumeric).Total(Model.GridResult.Total).PageSize(Model.GridSize, Model.GridSizes))
    .Pageable(paging => paging.Style(GridPagerStyles.PageSizeDropDown | GridPagerStyles.NextPreviousAndNumeric).Total(Model.GridResult.Total))
    .Resizable(resize => resize.Columns(true))
    .Sortable(sorting => sorting.SortMode(GridSortMode.MultipleColumn))
    .Render();
%>
0
Rosen
Telerik team
answered on 30 May 2011, 04:25 PM
Hi Stefan,

Thank you for the additional information. We were able to recreate the described behavior and to address it. The fix will be available in the next internal build. Meanwhile I have updated your telerik points.

Best wishes,
Rosen
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
Stefan
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Stefan
Top achievements
Rank 1
Share this question
or