首页 > 技术文章 > GridView 服务端控件添加 js

yipeng-yu 2016-03-16 13:19 原文

针对服务端控件的 CommandField “Delete” 添加 js

 

 $("#GridView1").find("a").each(
        function() {
            var text = $(this).html();
            if (text == "Delete") {
                var td = $(this).parent().parent().children().eq(0);
                $(this).on("click", function() {
                    if (confirm("Delete the "+$(td).html()+"?")) {
                        return true; // 允许执行后台代码
                    }
                    else {
                        return false; //// 不允许执行后台代码
                    }
                });
            }
        }
     );

 

推荐阅读