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

Save Grid Settings

1 Answer 24 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ahmed
Top achievements
Rank 1
Ahmed asked on 23 Oct 2012, 01:15 PM
Dear
i need to save settings for grid but in same time i have my paging
 code :
public void CustomizedGridPagerSize(GridItemEventArgs e) {
        int allItemsCount = (e.Item as GridPagerItem).Paging.DataSourceCount;
        RadComboBox combo = (e.Item as GridPagerItem).FindControl("PageSizeComboBox"as RadComboBox;
        RadComboBoxItem item1 = new RadComboBoxItem("10""10");
        RadComboBoxItem item2 = new RadComboBoxItem("20""20");
        RadComboBoxItem item3 = new RadComboBoxItem("50""50");
        RadComboBoxItem item4 = new RadComboBoxItem("100""100");
        RadComboBoxItem item5 = new RadComboBoxItem("200""200");
        RadComboBoxItem item6 = new RadComboBoxItem("All", allItemsCount.ToString());
        item1.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
        item2.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
        item3.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
        item4.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
        item5.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
        item6.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
        combo.Items.Clear();
        combo.Items.Add(item1);
        combo.Items.Add(item2);
        combo.Items.Add(item3);
        combo.Items.Add(item4);
        combo.Items.Add(item5);
        combo.Items.Add(item6);
        combo.Items.FindItemByValue(((RadGrid)e.Item.OwnerTableView.Parent).PageSize.ToString()).Selected = true;
    }

if we use the default paging sizes then it is working well and we can load the grid settings,
but when we use the code above to increase the paging sizes then when we load the grid settings we found the pager not saved

Regards
AhmedSalem
 

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 25 Oct 2012, 02:06 PM
Hello Ahmed,

Could you please elaborate a bit more on your application? On which event are you calling CustomizedGridPagerSize? Using your code I have modified one of our demos and it behaves correctly. Please review the attached sample and let us know what differs in your case. Also I suggest that you use the PageSizes property of the RadGrid. RadGrid.MasterTableView.PagerStyle.PageSizes expects an array of integers that correspond to the desired page sizes. Attached is the sample solution of the modified demo.

Kind regards,
Angel Petrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Ahmed
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or