English 中文(简体)
在html缩略语网页上建立有条件的联系
原标题:Creating a conditional link in html apsx page

我正试图在我的网站上的一个用户领域建立联系。

在进行伐木后,用户便可进入网站的特定地区。 我想做的是建立一个由有条件声明控制的html链接。

for example, after a user logs in, I want to check whether they have credentials to click on a link which will allow them to advance to something new. If they don t have the credentials, the link will be blocked out or not appear at.

我期待着开始这项任务,任何文件或关键词都是有益的。 法典样本也大有帮助。

该网页是一页,背后有密码。

提前感谢。

最佳回答

我只是把你的逻辑放在页数上。

<<>ASPX>:

<asp:HyperLink ID="myHyperLink" runat="server"></asp:HyperLink>

www.un.org/Depts/DGACM/index_french.htm

Protected Sub Page_Load(sender As Object, e As EventArgs)
    If 1 = 1 Then
        myHyperLink.Visible = False
    End If
End Sub

ASPX Embedded/2007/3:

<asp:HyperLink ID="myHyperLink" runat="server" 
     Visible= <%# Eval("[Some Condition]") != null ? true : false %> >
     </asp:HyperLink>
问题回答

我知道这个问题已经得到回答,但如果你重新利用内在的作用管理,我总是倾向于这样做:

<asp:HyperLink ID="HyperLink1" runat="server" Text="Some Protected Page" ... />

在编码背后:

HyperLink1.Visible = User.IsInRole("admin");




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签