I am trying ot use C# / ASP.NET to pull a date from an Oracle Database and if the date is later than a certain day, hide a section of a form. The problem is, normally when I have been using a div runat=server to call from within ASP.NET I can just say CONTROLID.Visible=true and it works.
For some reason this form when run is prepending “mainContent_”, the ContentPlaceHolderID of the form plus an underscore, to any DIV’s run at the server. This means my CONTROLID is then renamed to mainContent_CONTROLID and is not shown.
How do you prevent this?
This is because the
PlaceHolderis anINamingContainer. ASP.NET, by default, builds a unique client ID based on the naming container hierarchy.Use
control.ClientIDin your client script or change theClientIDModetoStatic.