How to get the rowindex / value within an unbounded gridview in edit event?

I fill the data into a gridview as below:
dt = New DataTable()
            dt.Columns.Add(New DataColumn("Username", GetType(String)))
            dt.Columns.Add(New DataColumn("EnglishName", GetType(String)))
            dt.Columns.Add(New DataColumn("ChineseName", GetType(String)))
            dt.Columns.Add(New DataColumn("Role", GetType(String)))
            dt.Columns.Add(New DataColumn("ValidDate", GetType(String)))
            dt.Columns.Add(New DataColumn("EDIT", GetType(Button)))

            dr = dt.NewRow()

            dr.Item(0) = "chantaiman"
            dr.Item(1) = "CHAN Tai-man"
            dr.Item(2) = "YYY"
            dr.Item(3) = "System Administrator"
            dr.Item(4) = "1/1/2007 - 1/1/2009"

            dt.Rows.Add(dr)
            dr = Nothing
            dr = dt.NewRow()
            dr.Item(0) = "Hello World"
            dr.Item(1) = "How Are You"
            dr.Item(2) = "XXX"
            dr.Item(3) = "User"
            dr.Item(4) = "1/1/2008 - 31/12/2046"
            dt.Rows.Add(dr)

However, when in this gridview gv_userList_RowCommand , I want to know the button of which row is pressed. I want to know the row index or some cell values.

Thanks
LVL 1
clarkyipAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

VelioCommented:
the button's CommandArgument property should contain the index, i think.
0
VelioCommented:
and by that i mean the rowCommand's e argument :)
0
digitalZoCommented:
This will get the RowIndex:

Dim row As GridViewRow = gv_userList.Rows(e.RowIndex)
0
VelioCommented:
in GridView OnRowCommand event? GridViewCommandEventArgs doesn't appear to have a RowIndex property.

This one works ok:
Dim row As GridViewRow = GridView1.Rows(Convert.ToInt32(e.CommandArgument))
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
clarkyipAuthor Commented:
Thanks a lot
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.