problem with radgrid in pageindexchange event

Posted by user203127 on Stack Overflow See other posts from Stack Overflow or by user203127
Published on 2010-05-20T01:35:51Z Indexed on 2010/05/20 1:40 UTC
Read the original article Hit count: 818

Filed under:

Hi,

I Have radgrid in my page. When i turn off view state and in pageindexchanged event when click next page i am getting nothing. Simply a blank page. But when i turn on view state I am getting data in next pages. Is there any way to get the data. I cant turn on the view state due to performance issue. Please see the code below for the reference.

.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

public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, 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();
} 

© Stack Overflow or respective owner

Related posts about telerik