Learn the technique that you are going to use. Server controls or containers can be easily handled on the server side. How? itβs good that you did the first part, and you play runat="server" now you just need to give it an identifier so that it looks something like this, let it call id MyLink
<a runat="server" id="MyLink" href="~/" >Home</a>
-Then you noticed that I removed the Visible attribute. yes, because now we will have full control of it on the server side. Suppose you want to start from the first page with a hidden, well, thatβs easy: in your pageload event, we will use a good technique to determine that the code we will write will only run on the first load.
protected void Page_Load(object sender, EventArgs e) { //this condition means if is not post back (meaning the very first time only) if(!IsPostBack) { MyLink.Visible = false; } }
Now you got it, you can just make your control visible again whenever you just want
MyLink.Visible = true;
and done. lemme knows if you need more help!
if you want to make it string, it is a string value, not a bool, so you must wrap it in double quotes visible='<%: "false" %>' <= mark ""
user2384649
source share