|
-
October 5th, 2007, 10:21 AM
#1
Add hyperlink based on the user
Hi,
I have a very basic question. I have a single column datalist on my webpage which is a hyperlink and takes you to another page when clicked. I want to make this column a hyperlink based on the user permissions. So if the user has permission 'A' allow him to click on the link. Basically I want to make it a hyperlink if user has permission 'A' otherwise it should just be a simple text. Can anyone tell me how to do this.
Thanks for your help.
-
October 6th, 2007, 03:41 PM
#2
Re: Add hyperlink based on the user
It should be a simple If-Then statement in the ASP code. If permission = 'A' then Response.Write the link. If not, Response.Write as text.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
October 8th, 2007, 03:55 PM
#3
Re: Add hyperlink based on the user
Sorry I am really new to ASP .Net. I am not sure where I can add the if then statements. I am in the site.master page and here is what I have so far
Code:
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/temp.aspx"
Text='<%# Eval("SummaryTxt") %>' ></asp:HyperLink>
</ItemTemplate>
For this I want to check if user = "A" then
Code:
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/temp.aspx"
Text='<%# Eval("SummaryTxt") %>' ></asp:HyperLink>
else
Code:
<asp:Label ID="Label1" runat="server"
Text='<%# Eval("OutageSummaryTxt") %>' ></asp:Label>
Here are my questions.
1. How do I declare the variable user.
2. How do I start the if then clause.
Thanks for your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|