Javascript & ASP .NET problem
<p>I'm having some problems with implementing javascript controls in my asp.net page.  I would like to have a set of variables get their values based on some asp button controls.  Then I manipulate those buttons based on how they are clicked.  I'm having some issues though:</p>

<ol>
<li>Any global variables I define and give a value to are coming back as null</li>
<li>I can't run a onload event, because all my variables come back as null.  </li>
<li>I can't use the asp.net tags of visible="false" because then the javascript can't show the control for some reason.  </li>
<li>the javascript style.visibility="visible" doesn't really work as you can still see where the button would be - it just isn't visible.  </li>
</ol>

<p>So here is my code. The TL,DR is I'd like to run some behavior to conditionally show/hide buttons via js on load, and then hide/show buttons on different button clicks.  I know it is a scope issue, as the global variables return "null" when I test them, but I don't know a good workaround for that and the onload issue.  Thanks!</p>

<pre><code>var btnEdit = document.getElementById("&lt;%= cmdEdit.ClientID %&gt;");
var btnSave  = document.getElementById("&lt;%= cmdSave.ClientID %&gt;");
var btnCanvel = document.getElementById("&lt;%= cmdCancel.ClientID %&gt;");
var btnConfirm = document.getElementById("&lt;%= cmdConfirm.ClientID %&gt;");


function HideEdit(){

    $(btnEdit).hide();
    $(btnSave).show();
    $(btnCancel).show();
    $(btnConfirm).hide();

    document.getElementById("&lt;%= pnlWhy.ClientID %&gt;").style.visibility = "visible";
    document.getElementById("&lt;%= pnlRequest.ClientID %&gt;").style.visibility = "visible";
}

function testme() {
alert(btnEdit)

}
function loadpage(newwine){

    if (newwine==true){
        $(btnEdit).hide();
        $(btnSave).show();
        $(btnCancel).show();
        }
    else{
        $(btnEdit).show();
    }
$(btnConfirm).hide();
}
</code></pre>
