Add onclick event to buttonfield to gridview - asp.net

first you can see the gridview column properties as below picture


then add the RowCommand of grid view.
Code is below;

  protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
//this line is taking selected row value.
            int value = Convert.ToInt32(e.CommandArgument.ToString());
//this is shown for the data values exact what you want ..
            string  iStID = GridView1.Rows[value].Cells[1].Text;
//...then call to any other method to do your function ...
            
        }


Comments

Popular Posts