• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 698
  • Last Modified:

app_themes and changing image button image


I have a panel which expands and collapses.
when ever the panel is expanded or collapsed, it shows a different image to indicate the panel is collapsed or expanded.

however, i need to drive this off the themes folder
please see the code below, when the panel is expanded image changes to exapnded.jpg, but i need these images to sit in the themes folder, and depending on what theme is active, it will pull in the relevent image

the problem is that this page is a shared user control (rules out having it on its own master page or creating a new control just for this)

how would i acheive this (a background image in CSS isn't an option either)

thanks
<asp:ImageButton CssClass="togglePanel" ID="ToggleImage" runat="server" ImageUrl="~/images/collapse.jpg" AlternateText="collapse" />

Open in new window

0
paulCardiff
Asked:
paulCardiff
  • 2
2 Solutions
 
abelCommented:
Your best bet would be to change the CssClass on the fly, but considering all the restrictions you imply you may not be able to access that property.

The shared user control cannot be edited? I'd assume something like an externalized CssClass property on it, or something like CollapsedImageUrl and ExpandedImageUrl. If not, I hope you can change the user control. If not... options to do this neatly get slimmer...
0
 
dacITCommented:
I assume you're using JS to switch the image and the collapse expand options client side. I've accomplished this by setting the existing theme names into a JS variable on page load. Then you reference that variable in the JS to make your change to the image onClick.

So, on  page load server-side, add a javascript block that has the variables to hold the image name. Then use your existing theme to create the path to the Themes folder. Example, "../App_Themes/Blue/image/collapsed_Blue.gif".

Then on your client side click event, change the img url to the ones you set in the JS variable on page load.
0
 
abelCommented:
@dacIT: this was by long an abandoned question, but it is nice of you to still add some possible solutions. Maybe it will make the question alive again?
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now