我在我的页面上有一个radgrid。当我关闭视图状态并在pageindexchanged事件中单击“下一页”时,我什么也得不到。只是一张空白页。但是,当我打开视图状态时,我将在下一页中获取数据。有没有办法获取数据。由于性能问题,我无法打开视图状态。请参考下面的代码作为参考。
.aspx
<telerik:RadGrid ID="RadGrid1" OnSortCommand="RadGrid1_SortCommand" OnPageIndexChanged="RadGrid1_PageIndexChanged"
AllowSorting="True" PageSize="20" ShowGroupPanel="True" AllowPaging="True" AllowMultiRowSelection="True"
AllowFilteringByColumn="true" AutoGenerateColumns="false" EnableViewState="false" runat="server" GridLines="None"
OnItemUpdated="RadGrid1_ItemUpdated" OnDataBound="RadGrid1_DataBound">aspx.cs
公共分部类_Default : System.Web.UI.Page { protected void Page_Load(object _Default,EventArgs e) { LoadData();}
private void LoadData()
{
SqlConnection SqlConn = new SqlConnection("uid=tempuser;password=tempuser;data source=USWASHL10015\\SQLEXPRESS;database=CCOM;");
SqlCommand cmd = new SqlCommand();
cmd.Connection = SqlConn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "usp_testing";
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
RadGrid1.DataSource = ds;
RadGrid1.DataBind();
//RadGrid1.ClientSettings.AllowDragToGroup = true;
}
protected void RadGrid1_PageIndexChanged(object source, Telerik.Web.UI.GridPageChangedEventArgs e)
{
//RadGrid1.Rebind();
LoadData();
} 发布于 2010-05-20 19:29:57
尝试使用高级绑定来挂钩NeedDataSource网格事件,如以下示例所示:http://demos.telerik.com/aspnet-ajax/grid/examples/programming/needdatasource/defaultcs.aspx
因此,您应该能够在关闭视图状态的情况下进行分页。
迪克
https://stackoverflow.com/questions/2870526
复制相似问题