Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My Anchor tag in Aspx page:

ASP.NET
<a id="angerBonusPoints" href="../MyHome/UserBonusPoints.aspx" rel="external" data-role="button" style="visibility: hidden" data-icon="gear" data-theme="a" class="bonus"  runat="server">Bonus Points


i have given visibility= hidden so its working fine tag button is not visibiling in all pages

but i want this anchor button to be visible for one specific page how to do this.

my Code behiind page fallows:

C#
if (Request.FilePath.ToString().ToLower().Contains("/myhome/home"))
{ 
angerBonusPoints.Visible = true;
angerBonusPoints.Attributes.Add("href", "~/MyHome/UserBonusPoints.aspx");
}


i want that anchor button to be visible for the only one page but its not working.
pls do the need full

Regards,
Madhu
Posted
Updated 3-Jun-13 21:20pm
v2
Comments
lukeer 4-Jun-13 3:16am    
Please don't repost[^].
Instead, improve your original question using the "Improve question" link beneath it.

Remove
HTML
style="visibility: hidden"
from the HTML of your tag and then use
C#
Visible = false;
wherever you want to hide it and
C#
Visible = true; 
wherever you want to show it.
 
Share this answer
 
Comments
madhu nj 4-Jun-13 3:33am    
hi zafar thanks for your reply

i tired by using visible="false" in HTML page but its not working

Thats why i added style="visibility: hidden" in html page
Zafar Sultan 4-Jun-13 3:47am    
You don't have to set its visibility in HTML code. Do it from code behind. Add only this one:
<a id="angerBonusPoints" href="../MyHome/UserBonusPoints.aspx" rel="external" data-role="button" data-icon="gear" data-theme="a" class="bonus" runat="server">Bonus Points
madhu nj 4-Jun-13 8:15am    
thanx Zafar Sultan its working fyn

Regards,
Madhu
At runat="server" property to the anchor tag. After setting the property you'll able to access anchor tag through code. There you can set Visible property of anchor tag to true or false.
Try this:
C#
<a id="angerBonusPoints" runat="server" href="../MyHome/UserBonusPoints.aspx" rel="external" data-role="button" visible="false" data-icon="gear" data-theme="a" class="bonus">Bonus Points</a>

C#:
C#
angerBonusPoints.Visible = true; //For making anchor visible
angerBonusPoints.Visible = false; //For hiding anchor
 
Share this answer
 
Comments
madhu nj 4-Jun-13 8:14am    
thanx _Amy its working fyn

Regards,
Madhu

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900