Click here to Skip to main content
15,915,094 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public void  PagerButtonClick(object sender, EventArgs e)
   {
      string arg = e.CommandArgument.ToString();
       //string arg = sender.ToString();
       switch (arg)
       {
           case "next":
               //The next Button was Clicked
               if ((dgcategory.CurrentPageIndex < (dgcategory.PageCount - 1)))
               {
                   dgcategory.CurrentPageIndex += 1;
               }

               break;
           case "prev":
               //The prev button was clicked
               if ((dgcategory.CurrentPageIndex > 0))
               {
                   dgcategory.CurrentPageIndex -= 1;
               }

               break;
           case "last":
               //The Last Page button was clicked
               dgcategory.CurrentPageIndex = (dgcategory.PageCount - 1);
               break;
           default:
               //The First Page button was clicked
               dgcategory.CurrentPageIndex = Convert.ToInt32(arg);
               break;
       }
       //selpagecombo()
       //Now, bind the data!
       BindCategory();
   }



but i got an error given below

VB
'System.EventArgs' does not contain a definition for 'CommandArgument' and no extension method 'CommandArgument' accepting a first argument of type 'System.EventArgs' could be found (are you missing a using directive or an assembly reference?)
Posted
Comments
narendrarathod 19-May-10 10:26am    
i tried also CammandEventArgs but that got also error im using linkbuttons for pagging here i write code of tht paggin button


<asp:linkbutton id="FirstButton" onclick="PagerButtonClick" runat="server" cssclass="contant" commandargument="0">
First Page<asp:label id="lblFirstLine" runat="server"> | 
<asp:linkbutton id="PrevButton" onclick="PagerButtonClick" runat="server" cssclass="contant" commandargument="prev">Prev<asp:label id="lblLine" runat="server"> | 
<asp:linkbutton id="NextButton" onclick="PagerButtonClick" runat="server" cssclass="contant" commandargument="next">Next<asp:label id="lblLastLine" runat="server"> | 
<asp:linkbutton id="LastButton" onclick="PagerButtonClick" runat="server" cssclass="contant" commandargument="last">
Last Page

1 solution

CommandArgument is a member of the CommandEventArg class not the EventArgs class.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900