Paging for Datagridview (e.g. 1.2.3...)
1. Add following lines in GridView tag of aspx
AllowPaging="True" PageSize="100"
PagerSettings-Position = "TopAndBottom"
OnPageIndexChanging="EventName"
2. Write the Event function in .CS file
datagrid.PageIndex = e.NewPageIndex;
this.functiontofilldatagrid(); // call the function where grid is loaded
e.g.
In Aspx:
<asp:GridView ID="dtgoutwardstockspare" runat="server" AutoGenerateColumns="False" AllowPaging="True" PageSize="100" PagerSettings-Position = "TopAndBottom"
OnPageIndexChanging="Paginateoutwardstockspare"/>
In .CS:
protected void Paginateoutwardstockspare(object sender, GridViewPageEventArgs e)
{
dtgoutwardstockspare.PageIndex = e.NewPageIndex;
this.filloutwardstockspare(); //function where grid is loaded eg. during view button click
}
public void filloutwardstockspare()
{
dtgoutwardstockspare.DataSource = dsSearchData;
dtgoutwardstockspare.DataBind();
}

Comments
Post a Comment