Home > Web Front-end > JS Tutorial > body text

Jquery implements three-layer traversal deletion function code_jquery

WBOY
Release: 2016-05-16 17:35:47
Original
1085 people have browsed it
aspx页
复制代码 代码如下:







全选反选ID="Button1" runat="server" Text="删除" onclick="Button1_Click" />



















后台cs文件
复制代码 代码如下:

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
load();
}
}
private void load()//就实现绑定
{
Jquery三层实现删除功能.Model.T_News mm = new Model.T_News();
Jquery三层实现删除功能.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(object sender, EventArgs e)
{
//遍历每一行
foreach (GridViewRow item in GridView1.Rows)//一定要记住这里是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("删除成功");
}
load();
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template