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

Radgrid on Q2 2010 SP2

4 Answers 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kavitha
Top achievements
Rank 1
kavitha asked on 29 Mar 2011, 06:27 PM

Hello

   I am trying to customize the pagesize combo, but as a result the OnPagesizechanged event is not firing. Please help. Following is the code snippet


.ASPX

 < telerik:RadGrid AutoGenerateColumns="false" Width="100%" ID="RadGrid1" onneeddatasource
="RadGrid1_NeedDataSource" AllowFilteringByColumn="True" AllowSorting="True" OnItemDataBound
="RadGrid1_ItemDataBound"
PageSize="1" ShowFooter="True" AllowPaging="True" runat="server" OnPageSizeChanged
="RadGrid1_PageSizeChanged" GridLines="None" EnableLinqExpressions="false" OnItemCommand
="RadGrid1_ItemCommand">
<PagerStyle Mode="NextPrevAndNumeric"/> 

 

 

 

 

 

 


.Cs

 

 

 

 

protected void RadGrid1_ItemDataBound(object source, GridItemEventArgs e)
    {
        if (e.Item is GridPagerItem)
        {
            RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");

 

            PageSizeCombo.Items.Clear();          
            PageSizeCombo.Items.Add(new RadComboBoxItem("1"));
            PageSizeCombo.FindItemByText("1").Attributes.Add("ownerTableViewID", RadGrid1.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("10"));
            PageSizeCombo.FindItemByText("10").Attributes.Add("ownerTableViewID", RadGrid1.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("15"));
            PageSizeCombo.FindItemByText("15").Attributes.Add("ownerTableViewID", RadGrid1.MasterTableView.ClientID);

 

            //PageSizeCombo.Attributes.Add("ownerTableViewID", RadGrid1.MasterTableView.ClientID);           
            PageSizeCombo.FindItemByText(RadGrid1.PageSize.ToString()).Selected = true;
            PageSizeCombo.AutoPostBack = true;
            //PageSizeCombo.EnableViewState = true;           
        }
    }

 

    protected void RadGrid1_PageSizeChanged(object sender, GridPageSizeChangedEventArgs e)
    {
        int i = e.NewPageSize;
    } 

 

 

 

 

 

 

 

 

 

 

 

Please let me know how i can get the PageSizeEventChanged event to fire. I would like to mention that i am using a RadAjaxManager on the page.

Thanks,
Kavitha

4 Answers, 1 is accepted

Sort by
0
Pavel
Telerik team
answered on 30 Mar 2011, 11:53 AM
Hello Kavitha,

Could you remove this line from your code:
PageSizeCombo.AutoPostBack = true;
It is not necessary and might be causing the unwanted behavior.

Regards,
Pavel
the Telerik team
0
kavitha
Top achievements
Rank 1
answered on 01 Apr 2011, 05:49 PM
If I remove that there is absolutely no reaction on the page. The radgrid just remains the same
0
Accepted
Pavel
Telerik team
answered on 04 Apr 2011, 09:23 AM
Hello Kavitha,

I am attaching for you a simple test page which works as expected on my end. Take a look at it and see what is different in your problematic grid.

Kind regards,
Pavel
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
kavitha
Top achievements
Rank 1
answered on 05 Apr 2011, 07:35 PM
Hi,

  Thank you, that fixed the issue, i think the problem was i was using

PageSizeCombo.FindItemByText("1").Attributes.Add("ownerTableViewID", RadGrid1.MasterTableView.ClientID);

instead of

PageSizeCombo.FindItemByText("1").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID);


that is really the only difference i can see, but it is working now.

thank you
Tags
Grid
Asked by
kavitha
Top achievements
Rank 1
Answers by
Pavel
Telerik team
kavitha
Top achievements
Rank 1
Share this question
or