我有一個gridview,我在每行中使用複選框。我試圖訪問每一行的複選框,並試圖找出哪些複選框已checked.buut當我嘗試運行下面的code.the條件總是假的,內部如果條件是從來沒有達到code.kindly提前幫助我。訪問gridview中選中的複選框
protected void btn_3id_Click(object sender, EventArgs e)
{
string str = "";
string srr = "";
for (int i = 0; i < GridView1.Rows.Count;i++)
{
CheckBox chk = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1");
if (chk.Checked==true)
{
if (str == "")
{
str = GridView1.Rows[i].Cells[0].Text.ToString();
}
else
{
srr = str + "," + GridView1.Rows[i].Cells[0].Text.ToString();
}
}
}
Session["Card_id"] = str;
Response.Redirect("ID.aspx");
}
haan shekhar那是原來的問題。謝謝男人 – Robin 2013-03-20 05:29:54
@Robin不客氣 – 2013-03-20 05:56:21