aspx页:
后台cs文件:
protected void Page_Load(객체 전송자, EventArgs e)
{
if (!IsPostBack)
{
load();
}
}
private void load()//就实现绑정
{
Jquery3层实现删除功能.Model.T_News mm = new Model.T_News();
Jquery 3层实现删除功能.BLL.T_News bb = new BLL.T_News();
string sqlwhere = "Id<25";
ds = bb.GetList(sqlwhere);//获取dataset绑정
this.GridView1.DataSource = ds;
GridView1.DataBind();
}
protected void Button1_Click(객체 전송자, EventArgs e)
{
//遍历每一行
foreach(GridView1.Rows의 GridViewRow 항목)//一정要记住这里是gridviewrow不是datarow
{
CheckBox cb = (CheckBox)item.FindControl("CheckBox3");//找到这个选中项
if (cb.Checked)//选中
{
Jquery 삼层实现删除功能.BLL.T_News bb = new BLL.T_News();
if (bb.DeleteList(item.Cells[1].Text))//调용bb.DeleteList(id)删除
{
Response.Write("删除成功");
}
로드()