简体   繁体   English

仅禁用ASP.Net LinkBut​​ton的链接部分

[英]Disable only the link part of a ASP.Net LinkButton

I have a ASP.Net LinkButton in a Repeater. 我在中继器中有一个ASP.Net LinkBut​​ton。 In some conditions on some rows i'm trying to disable the link of the button so that it acts more like a Label, where other rows will be a link that fires off the ItemCommand event. 在某些情况下,我尝试禁用某些按钮的链接,以使其更像Label,而其他行将是触发ItemCommand事件的链接。

What is a good solution for this? 有什么好的解决方案? I'm trying to avoid having two separate control on the page to handle pretty much the same thing. 我试图避免在页面上使用两个单独的控件来处理几乎相同的事情。

Anyone have experience with this? 有人对此有经验吗?

Wire into the ItemDataBound event for the repeater. 连接到转发器的ItemDataBound事件。 In each item, find the link button, and then use a method like on this solution to disable the link button on an item by item basis 在每个项目中,找到链接按钮,然后使用类似此解决方案的方法逐个项目禁用链接按钮

How to completely disable the link button? 如何完全禁用链接按钮?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM