If still not working then try belowprotected void grdUser_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex = Convert.ToInt32(e.CommandArgument.ToString()); Label lblName = (Label)grdUser.Rows[rowIndex].FindControl("lblName"); btnGetAllControls.Text = lblName.Text; }
If still not working then try below
ReplyDeleteprotected void grdUser_RowCommand(object sender, GridViewCommandEventArgs e)
{
int rowIndex = Convert.ToInt32(e.CommandArgument.ToString());
Label lblName = (Label)grdUser.Rows[rowIndex].FindControl("lblName");
btnGetAllControls.Text = lblName.Text;
}