How would I set an image to come from a theme directory (my theme changes so I don't want to directly reference) I am sure this is possible but every example I find doesn't seem to work. They are usually along the lines of:
asp:image ID="Image1" runat="server" ImageUrl="~/Web/Mode1.jpg" /
where Web would be a sub directory in my themes folder. Suggesting the theme directory would be added at runtime.
If you are wanting to reference an Image in your Theme folder, then I suggesting using a SkinId. Inside the skin file of each Theme Folder you would define something like this
<asp:Image runat="server" SkinId="HomeImage" ImageUrl="Images/HomeImage.gif" />
When you go to use the image in your code you do something like this...
<asp:Image runat="server" SkinId="HomeImage" />
Depending on the theme your application has picked it will pick up the correct image from the correct Theme folder.
MyWebSite
App_Themes
Theme1
Default.skin
Default.css
Images
HomeImage.gif
Theme2
Default.skin
Default.css
Images
HomeImage.gif
Here is a good article explaining how to use themes, skins, and to set the theme several different ways.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With