CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

MS SQL 2008 on ASP.NET Hosting



Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 1/11/2006 6:15:56 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 11 Views: 61 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
12 Items, 1 Pages 1 |< << Go >> >|
IluDeR
Asp.Net User
Master Pages And Themes - Images Path question1/11/2006 6:15:56 PM

0/0

Hi!

I've been doing some work in the new Visual Studio, and i've encounter some problems in the reference of images when using a Theme.

I've got this directory structure in my web project:

root\
  App_Theme\
    Default\
      Images\
        Controls\
          Tree\
            Tree.Gif
  Docs\
    DOcuments.aspx
  MainMasterPage.Master
  DocsMasterPage.Master

I've got the "DocsMasterPage.Master"  Inherits from the MainMasterPage.Master. And the "Documents.aspx" inherits from the "DocsMasterPage.Master".

I've got a TreeView control in the "DocsMasterPage.Master", and i need to reference the image inside the theme folder to a node. Something like this..

<asp:TreeNode NavigateUrl="" Value="ID=1" Text="ROOT" ImageUrl="Images/Controls/Tree/root.gif">

How do i put the imageurl? I've tried, like the example above, like "~/images" and "/images", none of that worked.

Can anyone help me?

Thanks in advance.


__________________________________________

IluDeR
Portuguese
taniam
Asp.Net User
Re: Master Pages And Themes - Images Path question1/11/2006 11:17:37 PM

0/0

You want to use the "~/" format, but you'll need to specify the complete path, which in your case would look like "~/App_Theme/Default/Images/Controls/Tree/Tree.gif".

 

Hope this helps!


Tania

ASP.NET Team



This posting is provided "AS IS" with no warranties, and confers no rights.
IluDeR
Asp.Net User
Re: Master Pages And Themes - Images Path question1/11/2006 11:23:54 PM

0/0

Hmm...thank you for your response, i will try that first thing tomorrow.

But i've got dynamic Themes, depending on the client that is using the WebSite, if i put the complete path, how do i still keep this working? I could alter the url every time the Theme is altered, but my goal is to create a custom website, not worring about the urls....Is this possible in some way?

Thank you again very much.

__________________________________________

IluDeR
Portuguese
taniam
Asp.Net User
Re: Master Pages And Themes - Images Path question1/12/2006 12:25:21 AM

0/0

Oh, sorry, I glossed over the themes aspect of the question.

After reading more closely Smile [:)] I set up a web like yours and was able to get the image to display by setting ImageUrl="Images/controls/tree/tree.gif".  I put the skin file for the default theme in the Default directory.  Is that where yours is?

I also just noticed that in your web structure the image file is listed as "tree.gif", but the treenode is trying to use a "root.gif".  If that's not a type in the post, that could be the source of the problem.


Tania

ASP.NET Team



This posting is provided "AS IS" with no warranties, and confers no rights.
jcasp
Asp.Net User
Re: Master Pages And Themes - Images Path question1/12/2006 12:32:38 AM

0/0

The way you're explicitly referencing the Image sub-directory within the App_Theme goes counter to how Theme should be used.  Instead, you should be defining a SkinFile(s) under the App_Theme directory (another subdirectory for the skin) that contains the definition for the control involved (minus the ID or other page specific attributes) so that changing the Theme value later makes everything portable (contained within each Theme directory).  Any other resources that are not related to Theme should not be kept under the App_Theme directory in order to avoid the exact issue you're facing.  Hopefully what I posted is not too confusing...  Good luck.
IluDeR
Asp.Net User
Re: Master Pages And Themes - Images Path question1/12/2006 12:35:18 AM

0/0

Hi...no that's was my mistake, it's the same image, my fault, sory, i've write tree.gif to explain my ideia better.

Hmm..i'm not using a skin file for the treenode. Is it possible? In the properties of the nodes, i can't find a SkinId... how did you managed that? Can you give me a example?

I've notice that, to use images in the theme, you have to set the path in the skin file, not in the .aspx html file. Can this be my problem? Then then, how can i set a skinid in a specific treenode?

Thank you once more.


__________________________________________

IluDeR
Portuguese
IluDeR
Asp.Net User
Re: Master Pages And Themes - Images Path question1/12/2006 12:36:57 AM

0/0

Hi, thank you for your reply...

Hmm...i've understand that now, but how can i set a skinid to a speficic treenode?

Thank you.

__________________________________________

IluDeR
Portuguese
jcasp
Asp.Net User
Re: Master Pages And Themes - Images Path question1/12/2006 2:20:46 AM

0/0

IluDeR wrote:
Hi, thank you for your reply...

Hmm...i've understand that now, but how can i set a skinid to a speficic treenode?

Thank you.


Sorry if you misunderstood.  I didn't mean to imply that TreeNode can be used in SkinFile, just the fact that shared resources not specific to individual Theme should not be placed under the App_Themes directory.  Doing so will require a tricky bit of coding to identify the current theme and calculating the folder path associated with the changes in Theme.
IluDeR
Asp.Net User
Re: Master Pages And Themes - Images Path question1/12/2006 11:02:47 AM

0/0

taniam wrote:

You want to use the "~/" format, but you'll need to specify the complete path, which in your case would look like "~/App_Theme/Default/Images/Controls/Tree/Tree.gif".

 

Hope this helps!



Hi...that worked. It's not the best way to do this, but until i can apply a specific skin to a treenode, this was the only solution that worked. Now, i just have to alter the string, using the current theme.

Thank you Tania.



__________________________________________

IluDeR
Portuguese
NamelessParanoi
Asp.Net User
Re: Master Pages And Themes - Images Path question8/13/2007 1:48:53 PM

0/0

jcasp:
The way you're explicitly referencing the Image sub-directory within the App_Theme goes counter to how Theme should be used.  Instead, you should be defining a SkinFile(s) under the App_Theme directory (another subdirectory for the skin) that contains the definition for the control involved (minus the ID or other page specific attributes) so that changing the Theme value later makes everything portable (contained within each Theme directory).  Any other resources that are not related to Theme should not be kept under the App_Theme directory in order to avoid the exact issue you're facing. 
 

Took me quite a while to realise that what Star said actually alludes to the solution (though it doesn't state it outright).

If you reference an image from a content page or master page using ImageUrl it simply will not work.  It assumes you are referencing a file in the root directory rather than converting that reference according to the currently applied theme for the content page.

The only way to reference images in a theme from any page (without hardcoding a reference to "App_Themes/MyTheme/resource.bmp", which COMPLETELY defeats the point of themes and is a fairly pointless exercise) is to create a skin that defines the url of various types of images and apply them on the page by declaring an <asp:Image ...> object with the appropriate SkinID reference.

So, for a structure of:

 root\
  App_Theme\
    Default\

      skin file goes here under theme root directory

      Images\
            imagename1.Gif

            imagename2.Gif


  Docs\
    DOcuments.aspx
  MainMasterPage.Master
  ContentPage.aspx

 

Create the .skin file with

<asp:Image runat="server" ImageUrl="images/imagename1.gif" SkinID="imageTypeID1" />

<asp:Image runat="server" ImageUrl="images/imagename2.gif" SkinID="imageTypeID2" />
 

Then apply the theme in the content page and set up the images using the following markup in the content/master page:

<asp:Image runat="server" SkinID="imageTypeID1" />

<asp:Image runat="server" SkinID="imageTypeID2" />

J_D_Cebrian
Asp.Net User
Re: Master Pages And Themes - Images Path question11/9/2007 8:25:20 AM

0/0

I have a GridView with two columns.

In the first column I will show an Item's Description. In the second column I will show an Item's current Status represented by an image.

Using your "SkinID" approach I think I could get the Status Image using the Current Theme.

But how can I set a "Themed" image on the column header? The "HeaderTemplate" comes with a "HeaderImageUrl" property, but it comes without any "SkinID".

<asp:GridView ID="gv" runat="server">
<Columns>
<asp:BoundField HeaderText="Item Description" DataField="Description" >
<asp:TemplateField HeaderText="Item Status" HeaderImageUrl="??? HOW CAN I MAKE THIS PATH THEMEABLE ???">
<ItemTemplate>
<asp:Image ID="imgItemStatus1" runat="server" SkindId="imgSkinItemStatus1" Visible='<%# Eval("ItemStatus") == 1 %>' />
<asp:Image ID="imgItemStatus2" runat="server" SkindId="imgSkinItemStatus2" Visible='<%# Eval("ItemStatus") == 2 %>' />
<asp:Image ID="imgItemStatus2" runat="server" SkindId="imgSkinItemStatus3" Visible='<%# Eval("ItemStatus") == 3 %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

 

Does somebody have any ideas on how to accomplish this without using server side code?

 

Thanks in advance.

J_D_Cebrian
Asp.Net User
Re: Master Pages And Themes - Images Path question11/9/2007 2:34:18 PM

0/0

Please, don't worry about this.

A coworker helped me Smile to realize that I could simply use a "<HeaderTemplate>" the same way I use the "<ItemTemplate>".
 

12 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Pro ASP.NET 2.0 in VB 2005: From Professional to Expert Authors: Laurence Moroney, Matthew MacDonald, Pages: 1253, Published: 2006
Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages Authors: Jacob J. Sanford, Pages: 474, Published: 2007
ASP.NET 2.0 Black Book: black book Authors: Dreamtech Software, Dreamtech Software, Charul Shukla, Anil Kumar Barnwal, Dreamtech Software India, Pages: 1167, Published: 2006
Practical Mono Authors: Mark Mamone, Pages: 403, Published: 2005
Dictionary of Biblical Imagery: An Encyclopedia Exploration of the Images, Symbols, Motifs, Metaphors, Figures of Speech, Literary Patterns and Universal Master Images of the Bible Authors: Leland Ryken, Jim Wilhoit, James C. Wilhoit, Tremper Longman, Colin Duriez, Douglas Penney, Daniel G. Reid, Pages: 1058, Published: 1998
Beginning ASP.NET 3.5: In C# and VB Authors: Imar Spaanjaars, Pages: 734, Published: 2008
Giancarlo De Carlo: Layered Places Authors: John McKean, Giancarlo De Carlo, Pages: 207, Published: -1
ASP.NET 2.0: Your Visual Blueprint for Developing Web Applications Authors: Chris Love, Pages: 339, Published: 2007
The Writer's Path: A Guidebook for Your Creative Journey : Exercises, Essays, and Examples Authors: Todd Walton, Mindy Toomay, Pages: 256, Published: 2000

Web:
Master Pages And Themes - Images Path question - ASP.NET Forums Re: Master Pages And Themes - Images Path question ... Re: Master Pages And Themes - Images Path question ...
Referencing images (path) in MasterPages - ASP.NET Forums My Logo. also if you are using master pages with themes... your style sheet will ...
Master Pages and Themes Master Pages and Themes. U. sing the techniques you’ve learned so far, ..... a content page in another subfolder, the image path is interpreted relative to ...
master pages question - ASPnix Web Hosting - Forums master pages question. Last post 11-14-2006 5:56 PM by himawari. 6 replies. ... This image will not display on pages inside the members folder. HELP? ...
ASP.Net 2.0 - Master Pages: Tips, Tricks, and Traps Apr 11, 2006 ... Master pages use the theme specified by the page that is using them. ... NET will rebase the path to the gif file. The master page only ...
ASP.NET Master Pages Overview For example, you might put an Image control on a master page and set its ImageUrl ... However, themes are applied to master pages under these circumstances: ...
Customizing and Managing Your Site's Appearance / Part 3 - Page 2 It uses master pages to specify the structure of the site, themes, ... The master page contains both an advertisement banner image that is customized by ...
Creating a Layout Using Master Pages This section discusses the Master Pages feature in ASP.NET 2.0. ... like images or stylesheet or page references using a relative-path syntax, for example: ...
SharePoint Branding Tool (Themes, Master pages, Site Logos ... SharePoint Branding Tool (Themes, Master pages, Site Logos. .... -Different SharePoint language version support (Dynamic install path support - for Spanish ...
Themes & Master Pages - Are they enough ? Don’t get me wrong here, of the two, Master Pages and Themes, Master Pages are my ... Anyway, thanks for the great question, and allowing me to answer! ...

Videos:
www.moldytoaster.com may know with what pains we prepare ourselves for them. Besides, when BULWER thinks it right that the world should know that the idea of "La Vaili\'c...




Search This Site:










treeview questions.

why default page is always loaded when visiting other pages?

using default contentplaceholder content in empty contentplaceholder

navigation menu not uploading to hostsite

changing web site colors using themes - doubt

sending back values to opener pages with master pages

postbacks on a treevies

enable and disable menuitems

custom sitemapprovider and update of the menu associated

multiple sitemaps in one masterpage

user selecting styles from dropdownlists?

how do you get the wizard sidebar displayed on the right side?

how to use default masterpage?

htm map to placeholder

default content in master page

asp:menu items with images - skin code required please!

dynamicmenuitemstyle doesn't work well together with dynamichoverstyle in menu control

switching image on database value

highlight parentnode in menu

help save a poor programmer's health - menu text color...

sitemappath bound to web.sitemap

hierarchy of master pages and user controls

master page, menu and postback

several update panels

treeview images - where are they?

define the master page dinamically

external client script with master pages.

set a panel to visible = false in master page from a content page.

populate a treeview with a xml file

how to retrieve content page property from master page

  Privacy | Contact Us
All Times Are GMT