0
votes

I Have a GridView control. In That I have a 1 template field with 2 buttons ( Previous, Next ). When ever if i click those buttons i dont want to bind the dataset data to GridView. If i press paging numbers i want to bind data to GridView.

Any Help ?

1

1 Answers

3
votes

You can use GridView PageIndexChanging event and bind your dataset:

In GridView aspx, register like this:

 OnPageIndexChanging="gridView_PageIndexChanging"

In your code-behind (C# code):

protected void gridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
   gridView.PageIndex = e.NewPageIndex;
   gridView.DataSource = /* Specify your dataset you want to bind here */
   gridView.DataBind();
}