The right way to set image paths when using Themes?

Last post 11-29-2008 1:22 PM by Dave Sussman. 1 replies.

Sort Posts:

  • The right way to set image paths when using Themes?

    11-29-2008, 11:18 AM
    • Member
      31 point Member
    • goixq
    • Member since 10-09-2006, 3:12 PM
    • Posts 107

    Hello,

    Since I am using Themes now for my website I am setting paths to images in the aspx.vb file in the following fashion:

    imgAdmired.ImageUrl = "~/App_Themes/" & Page.Theme.ToString() & "/Photos/icons/icon_admired.jpg"

    How can I set the paths to images in aspx file instead of aspx.vb file?

    Or is there a more adequate way of working with images when Themes are implemented?

  • Re: The right way to set image paths when using Themes?

    11-29-2008, 1:22 PM
    Answer

    If you've got images that are theme specific then you should reference them from within the skin file; use a SkinID to target single controls. For example:

    <asp:ImageButton runat="server" SkinID="SubmitButton" ImageUrl="images/Submit.jpg" />

    You can then have submit.jpg within an images folder in the theme. The image path with be rebased by ASP.NET when the theme is applied.

Page 1 of 1 (2 items)