views:

597

answers:

3

hi. when I use " AllowPaging="True" " property in gridview and upload my webSite ,when I click next page , I can't see that and I see same record that I see already . point : I bind a dataBase on gridview,and I see that in gridview.above problem when I uplaod my website,happen . what is problem that I can't see next page of gridview ?

A: 

you need to set the current page index property in Page index chaged event. then call the bind method in next line. then only you able to see the next page and it will work.

example protected void SearchGrid_PageIndexChanging(object sender, GridViewPageEventArgs e) { //set the current page index for grid searchResultsGrid.PageIndex = e.NewPageIndex;

        //Bind the result sets
        BindSearchResults();

}

+1  A: 

I am having a bit of trouble completing understanding your question. I think your are basically trying to get paging to work on a gridview.

In addition to setting "AllowPaging=True", you will need to hook into your paging event like so:

  void GridView_PageIndexChanging(Object sender, GridViewPageEventArgs e)
  {
       e.NewPageIndex = e.NewPageIndex + 1;
       DataBind();
  }

Check it out on MSDN

cgreeno
A: 

Custom control would help to avoid writing on page level event handlers

YordanGeorgiev