As a bit of background, when you set the Visible
attribute on an ASP.NET server control (or a HTML server control) in code-behind or in the aspx markup, that control is not rendered in the HTML sent to the client and therefore it cannot be accessed because it does not exist on the client.
If you want to have a hidden element which you then want to make visible using client-side code (i.e. without doing a postback), then you can set the style display to none or use a CSS class with display: none
. This will still render the control in the HTML but the control will not be visible. You can then make the control visible and hide it using (respectively)
// to make visible
document.getElementById("<%= tbDate.ClientID %>").style.display = "block";
// to hide it
document.getElementById("<%= tbDate.ClientID %>").style.display = "none";