获取HTML'checkbox' 的值/Split

来源:互联网 发布:农村淘宝的利润是多少 编辑:程序博客网 时间:2024/06/15 17:11

<ItemTemplate>
      <input  type='checkbox' name='checked' value='<%# DataBinder.Eval(Container.DataItem, "dj_id")%>'>                                               
</ItemTemplate>      

 

if (Request["checked"] != null)
        {           
            string TempStr = Request["checked"].ToString();
            string[] Strs = TempStr.Split(',');
            foreach (string Str in Strs)
            {
                //Response.Write(Str);
                SqlConnection connection = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["connstring"].ToString());
                connection.Open();
                string sql = "delete from tb_myfile where dj_id='" + Str + "'";
                SqlCommand cmd = new SqlCommand(sql, connection);
                cmd.ExecuteNonQuery();
                connection.Close();
            }
            Response.Redirect("mymusicbox.aspx");
        }