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

[Solved] Page Size in the RadGrid is not working

7 Answers 1110 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Siva
Top achievements
Rank 1
Siva asked on 12 Mar 2013, 10:25 AM
Hi,
        While Changing the Pagesize of my radgrid from 10 to 20 or 50 the result is not bound to my grid.. I tried OnPageIndexChanged function but it shows error. The grid also needs to remind the changed page size even when the page no is changed. Please help wit a solution...

protected void RadGrid2_PageSizeChanged(object source, GridPageSizeChangedEventArgs e)

{

RadGrid2.PageSize = e.NewPageSize;
// bind function to grid

}
when i using this function all i got was Webserver.exe stopped working.
Am i missing anything?

7 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 12 Mar 2013, 11:24 AM
Hello,

If you used Advance data Binding method/NeedDataSource Event/SQLDataSource to bind your grid then no need to do this thing manually it will manage automatically.

Let me know if you used Custom pagging.

Thanks,
Jayesh Goyani
0
Siva
Top achievements
Rank 1
answered on 12 Mar 2013, 11:45 AM
hi jayesh I am using SQLdatasource dynamic binding. but its not working in default when i changed the page size to 20 grid shows nothing..
There is no custom paging in this proj. thnx
0
Jayesh Goyani
Top achievements
Rank 2
answered on 13 Mar 2013, 12:29 PM
Hello,

can you please provide your code?

Thanks,
Jayesh Goyani
0
Siva
Top achievements
Rank 1
answered on 14 Mar 2013, 06:02 AM

<telerik:RadGrid ID="RadGrid2" runat="server" 
         AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
         CellSpacing="0" GridLines="None" AllowAutomaticInserts="True" PageSize="10" AllowAutomaticUpdates="True">
      
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>

      <PagerStyle EnableSEOPaging="True" AlwaysVisible="true" > </PagerStyle>

<MasterTableView EditMode="InPlace" >
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>

<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>
 <Columns>
      
        <telerik:GridBoundColumn DataField="ID "
            FilterControlAltText="Filter Record Id column" HeaderText="Record Id"
            SortExpression="ID asc" UniqueName="Record Id">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Add_datetime" DataFormatString="{0:MM/dd/yyyy}" DataType="System.DateTime"
            FilterControlAltText="Filter Date reported column" HeaderText="Date Reported"
            SortExpression="Add_datetime asc" UniqueName="Date reported">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Staff_name "
            FilterControlAltText="Filter Requestor's Name column"
            HeaderText="Requestor's Name" SortExpression="Staff_name asc"
            UniqueName="Requestor's Name">
        </telerik:GridBoundColumn>
.
.
.
       
    </Columns>
  
   

<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
 <EditColumn ButtonType="PushButton"  UpdateText="Update"
                    UniqueName="EditCommandColumn1" CancelText="Cancel edit">
                </EditColumn>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>

0
Jayesh Goyani
Top achievements
Rank 2
answered on 14 Mar 2013, 02:17 PM
Hello,

your mark-up (.aspx) code looks seems good.

Can you please provide code of your grid binding method /  SQLdatasource dynamic binding ?

Thanks,
Jayesh Goyani
0
Siva
Top achievements
Rank 1
answered on 15 Mar 2013, 09:39 AM

void

 

GridBind(DataSet ds, RadGrid rg)

{

rg.DataSource = ds;

rg.DataBind();

}
where ds is the dataset returning by calling a storedprocedure with parameters, rg is the radgridID...

0
Andrey
Telerik team
answered on 20 Mar 2013, 07:54 AM
Hi,

The problem comes from the DataBind call. As this help article says when you want advanced functionality of RadGrid like paging, sorting, grouping or filtering you need to use advanced databinding(NeedDataSource).

Try to set the datasource of RadGrid only in the NeedDataSource event and you will succeed.

Greetings,
Andrey
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
Siva
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Siva
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or