Finding the lable/any control value after clicking the linkbutton inside the gridview
Code Behind File :
protected void btnClick_Click(object sender, EventArgs e)
{
GridViewRow clickedRow = ((LinkButton)sender).NamingContainer as GridViewRow;
Label lblID = (Label)clickedRow.FindControl(“lblEmpID”);
Session
[“patientEMRID”] = lblID.Text;
}
Note :
First line we finding the clickable row and then finding the label value inside the gridview. lblEmpID is the id of the lable .