各行のチェックボックスを使用しているグリッドビューがあります。各行のチェックボックスにアクセスして、チェックされているチェックボックスを見つけようとしていますが、以下のコードを実行しようとすると、条件は常にfalseになり、コードが条件に到達しない場合は内部になります。kindly助けてください。よろしくお願いします。
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");
}