1
我的頁面中有radgrid。當我關閉視圖狀態和pageindexchanged事件時點擊下一頁我什麼都沒有。只是一個空白頁面。但是當我打開視圖狀態時,我正在接收下一頁中的數據。有什麼方法可以獲取數據。由於性能問題,我無法打開視圖狀態。請參閱下面的代碼以供參考。RADGrid問題
的.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 { 保護無效的Page_Load(對象發件人,EventArgs的) { 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();
}