Tuesday, January 31, 2012

gridview allowpaging W/O datasource in asp net C#

grid view on the page as follows

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" AllowPaging="true" onpageindexchanging="GridView2_PageIndexChanging" >

protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
            GridView2.DataSource = ds;
            GridView2.PageIndex = e.NewPageIndex;
            GridView2.DataBind();
    }

Here ds is dataset.

No comments:

Post a Comment