Sign in | Join
Last post 04-03-2009 2:14 AM by mehul.bhuva. 3 replies.
Sort Posts: Oldest to newest Newest to oldest
the selected datakey corresponds to the selectedIndex, so if you need a specific datakey you could set the index to current row
Gridview1.SelectedIndex = e.CommandArgument Dim item As String = Gridview1.SelectedDataKey(0)
object
Can try this:
Eg:
if (e.CommandName == "Show") { GridViewRow row = (GridViewRow)((Control)e.CommandSource).NamingContainer; int DemoId = Convert.ToInt32(gvdemo.DataKeys[row.RowIndex].Value); //You will get id here.....You code goes Here.... }else if (e.CommandName == "Select1") { GridViewRow row = (GridViewRow)((Control)e.CommandSource).NamingContainer; int DemoId = Convert.ToInt32(gvdemo.DataKeys[row.RowIndex].Value); //You will get id here.....You code goes Here.... }}