deepti
deepti

Reputation: 729

Paging in grid view

using paging in grid view but as i go through pagess i need to click on page links.. it should work on single click .. but it goes other page only after double click... any idea why..

Upvotes: 0

Views: 422

Answers (2)

Arun Prasad E S
Arun Prasad E S

Reputation: 10115

simple and working

protected void grd_receipt_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    grd_receipt.PageIndex = e.NewPageIndex;
    grd_receipt.DataBind();
}

simply call the databind after

Upvotes: 1

TheGeekYouNeed
TheGeekYouNeed

Reputation: 7539

Make sure your code to call DataBind() on your grid is in it's own method. You'll need to call it in two places.

  1. On Page_load, if !IsPostBack, bind your grid.
  2. When you're paging, set the new page index, then bind your grid.

This will eliminate your problem.

Upvotes: 0

Related Questions