码迷,mamicode.com
首页 > Web开发 > 详细

20160113 js中选择多个check一块删除

时间:2016-01-13 21:26:54      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:

js中
<script type="text/javascript"> $(document).ready(function (e) { $("#Button2").click(function () { if (confirm("确认要删除么!")) { var all = $(".xuanzhong"); var code = ""; for (var i = 0; i < all.length; i++) { if (all.eq(i)[0].checked) { code += all.eq(i).val()+"|"; } } code = code.substring(0, code.length - 1); $.ajax({ url: "quanxuanshanchu.aspx", type:"POST", data: { ids:code }, datatype: "TEXT", success: function (data) { alert(data); window.location.href = "gongyingshang.aspx"; } }); } })

后台操作

  LXMallDBDataContext context = new LXMallDBDataContext();

        //取出Ajax传过来的值
        string uid = Request["ids"].ToString();
        string[] codes;
        codes = uid.Split(|);
        for (int i = 0; i < codes.Length; i++)
        {
            Goods_Supplier data = context.Goods_Supplier.Where(r => r.ids == Convert.ToInt32(codes[i])).First();
            context.Goods_Supplier.DeleteOnSubmit(data);
            
        }
        context.SubmitChanges();
        Response.Write("删除成功!!!!!!");

        Response.End();

 

20160113 js中选择多个check一块删除

标签:

原文地址:http://www.cnblogs.com/hz1234/p/5128423.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!