Disable HyperLink from code

In my project, I need to disable a hyperlink based on some conditions. So how can I do this from code using C #?

+4
source share
2 answers

in your aspx, add the runat = "server" attribute to the tag:

<a id="myHyperLink" runat="server">...</a> 

in the Page_load method:

 if( condition ) myHyperLink.Enabled = false; 
+9
source

in your aspx add runat = "server" and the id attribute to the tag:

in the Page_load method: if (condition) ep_sms.href = "#";

0
source

All Articles