如何在GridView中的一个以上按钮上启用JQuery单击事件 [英] How to enable JQuery click event on more then one button in GridView

查看:83
本文介绍了如何在GridView中的一个以上按钮上启用JQuery单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我正在使用带有按钮(btnDisable)列的Gridview.我已经将Clientidmode设置为static并调用了JQuery的函数.但是问题在于JQuery只允许GridView中所有页面的第一个按钮调用click事件.

Hi all

I am using a Gridview with a colum of Buttons (btnDisable). I have set Clientidmode to static and call a function of JQuery. But the problem is that JQuery only allows first button of all pages in GridView to call click event.

$(function () {
        $("#btnDisable").click(function () {
            alert("Hello");
        });
    });


按钮代码是


Button Code is

<asp:Button ID="btnDisable" runat="server" style="border:1px solid red; background:Silver" clientidmode="Static" Text="Disable"/>



需要您的帮助..

预先感谢.



Need your help..

Thanks in advance.

推荐答案

( function (){


(" ). /span>(){ alert(" ); }); });
("#btnDisable").click(function () { alert("Hello"); }); });


按钮代码是


Button Code is

<asp:Button ID="btnDisable" runat="server" style="border:1px solid red; background:Silver" clientidmode="Static" Text="Disable"/>



需要您的帮助..

预先感谢.



Need your help..

Thanks in advance.


为按钮分配一些css类名称,例如Cssclass ="mybtnclass",并在以下代码中使用cssclass名称

Assign some css class name for example Cssclass="mybtnclass" to button and use cssclass name in following code


这篇关于如何在GridView中的一个以上按钮上启用JQuery单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆