asp.NET Telerik RadGrid - 页面大小过滤器错误/不更新

时间:2011-10-21 13:07:00

标签: c# asp.net .net ajax telerik

我有一个基于ajax的telerik Radgrid工作正常,但页面大小部分。

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

当我尝试更改页面大小然后它完全消失,检查html,这是我得到的唯一代码:

<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>

这是调用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>

有任何线索吗? Tnx提前

2 个答案:

答案 0 :(得分:3)

要使用RadGrid启用分页,您应该使用OnNeedDataSource事件:

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

代码隐藏:

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;
}

答案 1 :(得分:0)

<MasterTableView>之上添加以下内容:

 <PagerStyle AlwaysVisible="True" />