我想選擇的GridView選擇的GridView的當前行不工作
的當前行int i = 0;
int a1, a2,a3;
string ida = Session["id"].ToString();
foreach (GridViewRow gv in grdreport.Rows)
{
Label id = (Label)grdreport.Rows[i].Cells[6].FindControl("lblid");
Label lblqus = (Label)grdreport.Rows[i].Cells[3].FindControl("Label1"); ;
Label lblans = (Label)grdreport.Rows[i].Cells[4].FindControl("Label2");
try //geting Officer ID
{
int j = 0;
DataTable dtofc = new DataTable();
conn.Open();
SqlCommand cmd = new SqlCommand("SP_FAQ_CCA", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("qryflg", "Officer1");
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dtofc);
officerDept = dtofc.Rows[j]["DeptId"].ToString();
QAId = dtofc.Rows[j]["QAId"].ToString();
conn.Close();
}
只選擇GridView控件的第一行,即使我點擊了第二排。 我也試過這樣:
Label id = (Label)grdreport.currentrow.cell[6].FindControl("lblid");
Label id = (Label)gv.FindControl("lblid");
,但它不工作爲好,請幫我這。
代碼rowcommand事件處理中? –
如何選擇行(通過單擊複選框或按鈕?) – Nimmi
不僅發佈內部代碼的完整功能。 –