tags:

views:

17

answers:

1

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].

    }
A: 

If I understand what you're asking...you don't need to loop...

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;}
}
Nick