Reputation: 65
Hi I'm trying to put a an Image invisible but only on one page. The images is part of my masterpage. So i thought i could use the image id to set it at false when I'm on that page but i cannot see the id when i'm in the class. It's like it doesn't exist.I'm doing an Asp.net project in VB.
Here the Html code for my banner:
<img alt="" src="pharmacy-banner.jpg"
style="width: 80%; height: 175px; margin-left: 0px" align="middle"
id="Picture" />
I don't have any code in Vb.net for the moment here what i tried:
Picture.Visible= False
Thx
Upvotes: 0
Views: 108
Reputation: 169
On the particular page add a specific class on the container which holds the image and in the style we can add display:none; or visibility:hidden;
Upvotes: 1
Reputation: 1908
You can add the following CSS only in the content Page:
#Picture {
display: none;
}
You must have a ContentPlaceholder
inside the tag in the master page.
<asp:ContentPlaceHolder ID="Head" runat="server">
</asp:ContentPlaceHolder>
Then, in the content page you reference this placeholder and add the CSS style:
<asp:Content ID="Content_Head" ContentPlaceHolderID="Head" runat="server">
<style type="text/css">
#Picture {
display: none;
}
</style>
</asp:Content>
Upvotes: 0
Reputation: 50728
You need to add runat="server"
:
<img alt="" runat="server"
src="pharmacy-banner.jpg"
style="width: 80%; height: 175px; margin-left: 0px" align="middle"
id="Picture" />
And then you will be able to access it in the code behind, to set it as hidden in the page you want.
Upvotes: 1