Attila
Attila

Reputation: 712

asp.NET Telerik RadGrid - Page Size filter Bug/not updating

I have a ajax based telerik Radgrid that works fine but the Page Size part.

<telerik:RadAjaxPanel runat="server" ID="radAjaxPanel">

When I try to change the page size then it completely disappears, inspecting the html, this is the only code I get:

<div id="ctl00_ctl00_MainBaseContentArea_MainContentArea_radGridTrafficSourcesOverview" class="RadGrid RadGrid_Default">
<input id="ctl00_ctl00_MainBaseContentArea_MainContentArea_radGridTrafficSourcesOverview_ClientState" type="hidden" name="ctl00_ctl00_MainBaseContentArea_MainContentArea_radGridTrafficSourcesOverview_ClientState" autocomplete="off">
</div>

This is the code to call the RadGrid:

    <div class="statisticsSection">
    <h2>Stats</h2>
    <telerik:RadGrid runat="server" ID="radGridContentOverview" AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true" PageSize="10" OnPageIndexChanged="radGridContentOverview_PageIndexChanged" >
        <MasterTableView>
            <Columns>
                <telerik:GridBoundColumn HeaderText="Text" DataField="PagePath" />
                <telerik:GridBoundColumn HeaderText="Visitors" DataField="PageViews" />
                <telerik:GridBoundColumn HeaderText="% Visitors" DataField="PageViewsPercentage" DataFormatString="{0:0.00}%" />                            
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    </div>

Any clue? Tnx in advance

Upvotes: 0

Views: 2476

Answers (2)

James Johnson
James Johnson

Reputation: 46057

To enable paging with the RadGrid you should use the OnNeedDataSource event:

<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" ...>

Code-behind:

protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    //get the datasource object from the database
    DataTable table = GetSomeData();

    //set the datasource - no need to call DataBind()
    RadGrid1.DataSource = table;
}

Upvotes: 3

SShebly
SShebly

Reputation: 2073

Above the <MasterTableView> add the below:

 <PagerStyle AlwaysVisible="True" />

Upvotes: 0

Related Questions