[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 304
  • Last Modified:

Avoiding onrowcommand event in paging

Hi in my gridview when i click on page tabs i get to first rowcommand and then paging event.Some pages i am getting error "index out of range",as i am setting the e.commandargument to rowindex and getting it back in rowcommand to acces the servercontrols.But i think during paging it first fires the onrowdatabound and e.commandargument is set to the page no=pageindex+1.That is why i am getting index out of range error as before setting the pageindex it tries to find out e.commandargument.
0
Sukeshjph
Asked:
Sukeshjph
1 Solution
 
anyoneisCommented:
You need to check the CommandName and treat the CommandArgument differently depending on the command. For a page event, you might get a page number, or you might get text, as in "Last". You don't need to set the NewPageIndex, it is set for you.

David
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now