Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have a gridview, in the item template of which i have taken a link button. At run time when i click on the link button i want the corresponding row number of the grid. plz help.......
Posted
Comments
[no name] 27-Jul-12 8:29am    
What have you tried?
Himu from Orissa 27-Jul-12 8:35am    
i m trying to access the row no in the gridview row command event, but i dont know how to get it

1 solution

Hi,
Try this:
Put it inside your RowCommand Event, where you are checking the command.
C#
if(e.CommandName="MyCommand"){
     GridViewRow gvr = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
     int RowIndex = gvr.RowIndex; 
}



--Amit
 
Share this answer
 
v4
Comments
Himu from Orissa 27-Jul-12 8:34am    
e.Row is not coming(in the inteligence)
i m trying to access it in the gridview_rowcommand event where 'e' is of type GridViewCommandEventArgs
_Amy 27-Jul-12 8:40am    
I modified the solution. Please check that.. Sorry, Because of telerik I confused.
Thanks.

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