WEB:?? CheckBox c = gridview.Rows[this.gridview.SelectedIndex].FindControl("CheckBox"); if(c.check) {}
for (int i = 0; i < GridView1.Rows.Count; i++) { CheckBox cb = (CheckBox)GridView1.Rows[i].FindControl("checkBox"); if (cb.Checked) { Label lab = (Label)this.GridView1.Rows[i].Cells[0].FindControl("lblCheck"); int id = int.Parse(lab.Text.ToString());
CheckBox c = gridview.Rows[this.gridview.SelectedIndex].FindControl("CheckBox");
if(c.check)
{}
{
CheckBox cb = (CheckBox)GridView1.Rows[i].FindControl("checkBox");
if (cb.Checked)
{
Label lab = (Label)this.GridView1.Rows[i].Cells[0].FindControl("lblCheck");
int id = int.Parse(lab.Text.ToString());
f=st.Delete(id);
if (f)
{
Response.Write("<script>alert('成功删除第'"+i+"'条')</script>");
//重新绑定数据
Bind();
}
else
{
Response.Write("<script>alert('未选中!')</script>");
}
<asp:CheckBox ID="checkBox" runat="server"/>
<asp:Label ID="lblCheck" Text='<%# Bind("Id") %>' Visible="false" runat="server"></asp:Label>
</ItemTemplate>
st.Delete(id);
谁知道你这个怎么写的.
如果是按照ID来删除,你循环的时候拼成一个1,2,3,4这样的传给delete就好了.
自己拼吧.