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

Changing page size in a dynamically created grid

1 Answer 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 19 Apr 2010, 03:35 PM
Hi,
I got a grid which is created in code-behind and where ViewState is disabled. The grid has a pager. My problem is that the grid does not keep its state and therefore the entry of the pager is reset to the standard entry.
Is there a possibility to use a pager in such a scenario?

Here is my code for the grid:
private void setGridProperties(RadGrid grid) 
        { 
            grid.ID = "rgTreeList"
            grid.EnableViewState = false
            grid.AutoGenerateColumns = false
            grid.AllowSorting = true
            grid.AllowPaging = true
            grid.AllowMultiRowSelection = true
            grid.AllowFilteringByColumn = false
            grid.GridLines = GridLines.None; 
            grid.Width = Unit.Percentage(100); 
            grid.HeaderStyle.Width = Unit.Pixel(150); 
            grid.AllowMultiRowSelection = true
            grid.MasterTableView.PagerStyle.Mode = GridPagerMode.NextPrevNumericAndAdvanced; 
            grid.ClientSettings.EnableRowHoverStyle = true
            grid.ClientSettings.Selecting.AllowRowSelect = true
            grid.ClientSettings.Scrolling.AllowScroll = true
            grid.ClientSettings.Scrolling.UseStaticHeaders = true
            grid.ClientSettings.Scrolling.SaveScrollPosition = true
            grid.ClientSettings.Resizing.AllowColumnResize = true
            grid.ClientSettings.Resizing.ClipCellContentOnResize = false
            grid.ClientSettings.Resizing.EnableRealTimeResize = true
            grid.ClientSettings.Resizing.ResizeGridOnColumnResize = true
            grid.MasterTableView.DataKeyNames = new string[] { "E_ID" }; 
            grid.MasterTableView.OverrideDataSourceControlSorting = true
            grid.MasterTableView.PageSize = 15;  
            grid.GroupingSettings.CaseSensitive = false
            grid.MasterTableView.PagerStyle.Width = 1000; 
            grid.MasterTableView.OverrideDataSourceControlSorting = true
            grid.MasterTableView.EnableColumnsViewState = false
        } 

Thanks for your help.

Best regards
Ferdinand

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 20 Apr 2010, 07:56 AM
Hi Uwe,

Please, note that the NextPrevNumericAndAdvanced grid pager type requires the ViewState of the control to be enabled. However, a possible solution for your case would be to store the grid ViewState in the Session (after it is enabled) as explained in the help article below:
Saving the grid ViewState in Session

Sincerely yours,
Pavlina
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
Marc
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or