我使用以下代码:
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 :(得分:0)
如果我明白你在问什么......你不需要循环......
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;}
}