的OnClientClick不工作在asp.net的LinkBut​​ton [英] OnClientClick does not works on asp.net LinkButton

查看:135
本文介绍了的OnClientClick不工作在asp.net的LinkBut​​ton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net 链接按钮,其中包含 OnClientClick 属性, c $ c> OnClientClick 永远不会被调用,它直接跳转到 OnClick 函数。

下面是2种方式我使用LinkBut​​ton作为:

I have an asp.net linkbutton, which contains the OnClientClick property, however the function within the OnClientClick never gets called, it directly jumps to OnClick function.
Below are the 2 ways I am using LinkButton as:

<asp:LinkButton ID="btn" CssClass="button" Text="Browse Thumbnail" runat="server" 
     OnClientClick="return confirm('Are you sure you want to delete?');">
</asp:LinkButton>

和:

<asp:LinkButton ID="lnkDelete" runat="server" 
     OnClientClick="return confirm('Are you sure you want to delete this slide?');" 
     CommandName="DeleteThumbnail" CommandArgument='<%# Container.DataItemIndex %>'>
   <asp:Image ImageUrl="~/images/delete.gif" ID="imgDelete" runat="server"></asp:Image>  
</asp:LinkButton>

这两种方法都无效。

任何人都可以提供一些解决方案。

Can anyone please provide some solution for the same.

推荐答案

很可能有一些其他页面元素阻止这个事件

There is most probably some other page element that is preventing this event from being fired.

您有其他可能会干扰的网页元素吗?您是否尝试删除所有其他页面元素,但这一个?你有一些可能干扰的AJAX调用吗?你试过这个与一个简单的html元素(不是asp.net)?

Do you have any other page elements that might interfere? Have you tried removing all other page elements but this one? Do you have some AJAX calls that might interfere? Have you tried this with a simple html element (not asp.net)?

你很可能在你的链接按钮中做的一切,但似乎问题是在别处。

You are most probably doing everything fine in your link button but it seems like problem is elsewhere.

这篇关于的OnClientClick不工作在asp.net的LinkBut​​ton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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