GridView 服务端控件添加 js

Posted MessageBox

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了GridView 服务端控件添加 js相关的知识,希望对你有一定的参考价值。

针对服务端控件的 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; //// 不允许执行后台代码
                    }
                });
            }
        }
     );

 

以上是关于GridView 服务端控件添加 js的主要内容,如果未能解决你的问题,请参考以下文章