I have rowcommand function, in which i m obtaining sr_no as datakey from a link button. now i want to know which row was that. How to get row index this way ?

So im guessing that you have a LinkButton or something like that to trigger the rowcommand event.

I think i have used this before and it works.

int rowIndex = Convert.toInt32(e.CommandArgument);

if that one above dont work you can try this lets say again that the rowcommand is trigger by a linkbutton you will do this.

GridViewRow row = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
int rowIndex = row.RowIndex;

I think Jibsosn is answered!!!! he is right try later one code --it may be return index from 0 to onwords
then you can find out the rows
Thnx Shakeb Ahmad Khan