禁用从code的超链接后面 [英] Disable a HyperLink from code behind

查看:247
本文介绍了禁用从code的超链接后面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目,我需要禁用基于某些条件的超链接。那么,如何能做到这一点从code后面使用C#?

In my project I need to disable a hyperlink based on some condition. So how can I do this from code behind using C#?

推荐答案

在您的ASPX,加上=服务器属性标签:

in your aspx, add runat="server" attribute to the tag:

<a id="myHyperLink" runat="server">...</a>

在Page_Load方法:

in Page_load method:

if( condition )
    myHyperLink.Enabled = false;

这篇关于禁用从code的超链接后面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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