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
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
There is no custom paging in this proj. thnx
can you please provide your code?
Thanks,
Jayesh Goyani
<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>
your mark-up (.aspx) code looks seems good.
Can you please provide code of your grid binding method / SQLdatasource dynamic binding ?
Thanks,
Jayesh Goyani
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...
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