惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Announcements
Recent Announcements
V
V2EX
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 聂微东
爱范儿
爱范儿
Jina AI
Jina AI
博客园 - Franky
IT之家
IT之家
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tailwind CSS Blog
博客园 - 三生石上(FineUI控件)
The Cloudflare Blog
M
MIT News - Artificial intelligence
aimingoo的专栏
aimingoo的专栏
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
J
Java Code Geeks
人人都是产品经理
人人都是产品经理
腾讯CDC
博客园_首页
月光博客
月光博客
有赞技术团队
有赞技术团队
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
MyScale Blog
MyScale Blog

博客园 - gengen

asp.net程序中最常用的三十三种编程代码 js+xml dataset读取xml 下拉 flash实现 js+xml DataList分页(与Repeater控件的例子相似,都以pubs数据库中的authors为例) 简单上传 Datalist分页 datagrid 绑定与简单分页 asp.net 常用文件上传下载 转的 移动控件 可拖放控件的使用 国家公务员考完了 RegularExpressionValidator javascript中模拟hashtable对数组进行快速查找 网页中提交按钮倒记时的实现 原作:mlg js技巧 WEB标准开发中的一些基本用法(连载中...)
批量删除
gengen · 2006-12-26 · via 博客园 - gengen
<%# DataBinder.Eval(Container.DataItem,"id") %><%# DataBinder.Eval(Container.DataItem,"mm") %><%# DataBinder.Eval(Container.DataItem,"id") %><%# DataBinder.Eval(Container.DataItem,"mm") %><%# DataBinder.Eval(Container.DataItem,"id") %><%# DataBinder.Eval(Container.DataItem,"mm") %><%# DataBinder.Eval(Container.DataItem,"id") %><%# DataBinder.Eval(Container.DataItem,"mm") %><%# DataBinder.Eval(Container.DataItem,"id") %><%# DataBinder.Eval(Container.DataItem,"mm") %><%# DataBinder.Eval(Container.DataItem,"id") %><%# DataBinder.Eval(Container.DataItem,"mm") %><%# DataBinder.Eval(Container.DataItem,"id") %><%# DataBinder.Eval(Container.DataItem,"mm") %>

<asp:DataList id="DataList2" style="Z-INDEX: 101; LEFT: 280px; POSITION: absolute; TOP: 104px"
  runat="server">
  <ItemTemplate>
  <asp:CheckBox id="chb" runat="server"></asp:CheckBox><%# DataBinder.Eval(Container.DataItem,"id") %>
  <%# DataBinder.Eval(Container.DataItem,"mm") %>
  </ItemTemplate>
  </asp:DataList>
  <asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 280px; POSITION: absolute; TOP: 64px" runat="server"
  Text="全选"></asp:Button>
  <asp:Button id="Button2" style="Z-INDEX: 103; LEFT: 336px; POSITION: absolute; TOP: 64px" runat="server"
  Text="delete"></asp:Button>

public void data()
  {
  SqlConnection con=new SqlConnection("server=.;database=pubs;uid=sa;pwd=123");
   SqlDataAdapter sda=new SqlDataAdapter("select * from ta",con);
   DataSet ds=new DataSet();
   sda.Fill(ds,"jobs");
   this.DataList2.DataSource=ds;
   this.DataList2.DataKeyField="id";
   this.DataList2.DataBind();
  }

  private void Button1_Click(object sender, System.EventArgs e)
  {
   foreach(System.Web.UI.WebControls.DataListItem Item in this.DataList2.Items)
   {
    CheckBox chb=(CheckBox)Item.FindControl("chb");
    chb.Checked=true;
   }
  }

  private void Button2_Click(object sender, System.EventArgs e)
  {
    foreach(System.Web.UI.WebControls.DataListItem Item in this.DataList2.Items)
       {
          CheckBox chb=(CheckBox)Item.FindControl("chb");
     if(chb.Checked==true)
     {
       string id=this.DataList2.DataKeys[Item.ItemIndex].ToString();
      SqlConnection con=new SqlConnection("server=.;database=pubs;uid=sa;pwd=123");
      con.Open();
      SqlCommand cmd=new SqlCommand("delete from ta where id='"+id+"'",con);
      cmd.ExecuteNonQuery();
      

     }
   }
   data();
    
     

  }