I have the following asp.net div setup on my page:
<div runat="server" id="ImageContainer">
<a href="<%# String.Format("/news/?Article={0}", Eval("ID")) %>"><img src="images/<%# Eval("Image") %>" class="ArticleImage"/></a>
</div>
and I know this is being created at the server as when I view it in developer tools its id is:
ctl00_body_ArticleInfoRepeater_ctl00_ImageContainer
which is being created by the server.
I now want to edit the Css under certain conditions by doing the following:
ImageContainer.CssClass = "invisibleClass";
My problem is, in the C# code I am getting the following error:
The name 'Image container' does not exist in its current context.
I have no idea why this is happening, as it clearly does exist.
Any ideas?