如何在代码后面启用/禁用Href链接 [英] How to Enable/Disable Href link at code behind

查看:94
本文介绍了如何在代码后面启用/禁用Href链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨...

我想根据某些条件启用/禁用Href链接,但我不知道如何... ???



仅启用/禁用不可见/隐藏...



我使用了以下代码,但它不起作用..

 <   a     href   = 用户.aspx    id   =  href_user    runat   = 服务器 > 用户<   / a  >  





代码背后



<前lang =c#> 如果(会话[ 管理员] == null
{
href_user.Disabled = false ;
}
else
{
href_user.Disabled = true ;
}

解决方案

如果Session值为null,我认为你需要设置为true ...

请检查...

属性Disabled工作正常...

如果要禁用锚标记,则需要将其设置为true ...

Hi...
I want to Enable/Disable Href link according some conditions but how i don''t know...???

Only Enable/Disable not Visible/Hide...

I have used following code but it''s not working..

<a href="User.aspx" id="href_user" runat="server">User</a>



code behind

if(session["Admin"]==null)
{
href_user.Disabled=false;
}
else
{
href_user.Disabled=true;
}

解决方案

I think you need to set to true if Session value is null...
Please check...
The property Disabled works fine...
You need to set it to true if you want to disable the anchor tag...


这篇关于如何在代码后面启用/禁用Href链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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