How to set property of an asp:Hyperlink in a template from a user control.

J

James P.

Hello there,

I have an asp hyperlink in a template page. In my user control page -
code behind page that uses the template, I'd like to turn this link
invisible in certain case. Is it possible?

This is my hyperlink:
<asp:HyperLink id="hplShoppingCart" runat="server" Font-Size="Larger"
Font-Names="Arial" NavigateUrl="../forms/ProductOrder.aspx?fn=c">Shopping
Cart</asp:HyperLink>

Thanks in advance,
James
 
N

Natty Gur

Hi,

do you mean Master pages (ASP.NET 2.0) ?

this.Master.Findcontrol("hplShoppingCart").Visible = false;

if not what exactly you mean by Template form ?

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
T

TJS

you can wrap it in a panel tag and set visibility of the panel when
condition is correct

<asp:panel id="pnl1" visible="False" runat="server">
<asp:HyperLink id="hplShoppingCart" runat="server" Font-Size="Larger"
Font-Names="Arial" NavigateUrl="../forms/ProductOrder.aspx?fn=c">Shopping
Cart</asp:HyperLink>
</asp:panel>
 
J

James P.

Natty Gur said:
Hi,

do you mean Master pages (ASP.NET 2.0) ?

this.Master.Findcontrol("hplShoppingCart").Visible = false;

if not what exactly you mean by Template form ?

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)52-8888377


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Thanks a lot, Natty. It's exactly what I need.
 
J

James P.

TJS said:
you can wrap it in a panel tag and set visibility of the panel when
condition is correct

<asp:panel id="pnl1" visible="False" runat="server">
<asp:HyperLink id="hplShoppingCart" runat="server" Font-Size="Larger"
Font-Names="Arial" NavigateUrl="../forms/ProductOrder.aspx?fn=c">Shopping
Cart</asp:HyperLink>
</asp:panel>

Thanks TJS. I like your solution.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top