How do I find the GridView item in button_click?

I am using the following code:

foreach (GridViewRow dr in gvrejectreq.Rows)
{
    DropDownList ddl=(DropDownList)gvrejectreq.Rows[dr.RowIndex].FindControl("DropDownList1");
    string status = ddl.SelectedValue;
    int userid = gvrejectreq.Rows[dr.RowIndex].
}

      

0


a source to share


1 answer


If I understand what you are asking ... you do not need to quote ...



protected void GridView1_RowCommand(Object sender, GridViewCommandEventArgs e){
   if (e.CommandName == "thiscommandname") {
      int index = Convert.ToInt32(e.CommandArgument);
      GridViewRow selectedRow = ((GridView)e.CommandSource).Rows[index];
      //and then for example...
      string rowText = (LinkButton)selectedRow.Cells[0].Controls[0]).Text;}
}

      

0


a source







All Articles