Control myControl1 = FindControl("btn1");
if (myControl1 != null)
{
myControl1.Visible = true;
}
Control myControl2 = FindControl("btn2");
if (myControl2 != null)
{
myControl2.Visible = true;
}
In my page load i have this two that i display two controls.
onclick in aspx page i have this
window.onload = function (e) {
document.getElementById("btn1").style.visibility = "hidden";
document.getElementById("btn2").style.visibility = "hidden";
};
I have this code here because i dont wont to display them on client side only on server side
but hiding them in server side click event on a hrefs is not firingen?
function ShowItems() {
document.getElementById("btn1").style.visibility="display";
document.getElementById("btn2").style.visibility="none";
}
function DontDisplayItems()
{
document.getElementById("btn1")style.visibility="none";
document.getElementById("btn2").style.visibility="display";
}
<div id="btn1" style="float:right;" runat="server">
<a href="#" >Button 1</a>
</div>
<div id="btn2" style="float:right;" runat="server">
<a href="#" >Button 2</a>
</div>
The problem is that my button wont be display: