如何为ASP.NET中的多个LinkBut​​ton控件创建单击事件函数。 Click事件函数应该用jQuery编写。函数应返回单击的LinkBut​​ton的ID [英] How to create single click event function for multiple LinkButton Controls in ASP.NET. Click event function should be written in jQuery. A function should return an ID of clicked LinkButton

查看:63
本文介绍了如何为ASP.NET中的多个LinkBut​​ton控件创建单击事件函数。 Click事件函数应该用jQuery编写。函数应返回单击的LinkBut​​ton的ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< pre lang =HTML>< pre lang =HTML> 





  • < asp:LinkBut​​ton ID =linkMenuProfilerunat =server

    onclick =linkMenuProfile_Click >个人资料

  • < / ul>

解决方案

在链接按钮中添加onclientclick事件,例如

< asp:LinkBut​​ton ID =   linkMenuProfile runat =   server onclientclick =   getId(this); 
onclick = linkMenuProfile_Click>



  function  getId(_this)
{
alert(


(_ this).attr(' id'));
}



尝试使用此jquery点击事件火灾....

 

' #<%= linkMenuProfile.ClientID%>' )。单击();


<pre lang="HTML"><pre lang="HTML">



  • <asp:LinkButton ID="linkMenuProfile" runat="server"
    onclick="linkMenuProfile_Click">Profile

  • </ul>

解决方案

add onclientclick event in linkbutton like

<asp:LinkButton ID="linkMenuProfile" runat="server" onclientclick = "getId(this);"
onclick="linkMenuProfile_Click">


function getId(_this)
{
   alert(


(_this).attr('id')); }


try this jquery for click event fire....


('#<%=linkMenuProfile.ClientID%>').click();


这篇关于如何为ASP.NET中的多个LinkBut​​ton控件创建单击事件函数。 Click事件函数应该用jQuery编写。函数应返回单击的LinkBut​​ton的ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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