473,692 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Theme + asp:menu + ImageUrl = Help

Ben
Hi, I'm using images in my menu control. I have my menu setup based on this
example:
http://msdn2.microsoft.com/en-US/lib...ld(VS.80).aspx

I have a theme and right now, the theme structure looks like...

App_Themes
--Authenticated
----Images
------Menu
--------Item.jpg
--------Item2.jpg
--------Item3.jpg
--------etc.jpg

In my menu.xml file I have my nodes defined as follows:
<MapHomeNode NavigateUrl="~/ProjectBackgrou nd/default.aspx"
ImageUrl="~/App_Themes/Authenticated/Images/Menu/application_hom e.png"
Title="Project Background"
Description="Pr oject Background"
ToolTip="Projec t Background">
</MapHomeNode>

My problem is that I can't seem to get the ImageUrl to funcion with the
themes. I've tried:
ImageUrl="Image s/Menu/application_hom e.png"
ImageUrl="/Images/Menu/application_hom e.png"
ImageUrl="~/Images/Menu/application_hom e.png"

I would expect the first one to work, but it doesn't!

Both of these work just fine (they both render the same way)
ImageUrl="~/App_Themes/Authenticated/Images/Menu/application_hom e.png"
ImageUrl="App_T hemes/Authenticated/Images/Menu/application_hom e.png"

I feel that I'm well versed in 1.1, but 2.0 remains egnigmatic. I'm sure
that I'm overlooking the obvious, would someone please help me out?

Thanks,
Mar 14 '06 #1
4 3408
Hi Bennett,

Welcome to the MSDN newsgroup.

Regarding on the Menu control with databinding xml source and Theme
question, based on my understanding, if you're wantting to both use XML
DataSource's attribute as databind source for ImageUrl , but also use Theme
(folder) specific path , that is not supported currently. This is because
the Theme specific path is only available to those setting which is defined
in the Theme file(skin file) which is compiled into certain control at
runtime (at the initialize time). For databinding , it occur after the
theme is applied, so it won't be able to utilize the Theme specific path
interpreting.

I've just performed some tests on my side and we can make our Node use the
theme specific path through those default properties instead of databinding
field(since these properties can be set in the skin file that can be
compiled at theme initialize time). For example:

========in skin file=========== ======

<asp:Menu SkinID="Main" runat="server" >
<DataBindings >
<asp:MenuItemBi nding DataMember="Map HomeNode" FormatString="( {0})"

Target="_self" TextField="Titl e" ToolTipField="T oolTip"
ValueField="Des cription"
ImageUrl="Image s/Menu/item.jpg"
/>
<asp:MenuItemBi nding DataMember="Map Node" FormatString="[{0}]"
Target="_blank" TextField="Titl e"
ToolTipField="T oolTip" ValueField="Des cription"
Depth="1" ImageUrl="Image s/Menu/item1.jpg"/>
<asp:MenuItemBi nding DataMember="Map Node" FormatString="| {0}|"
Target="_blank" TextField="Titl e"
ToolTipField="T oolTip" ValueField="Des cription"
Depth="2" ImageUrl="Image s/Menu/item2.jpg"/>
</DataBindings>
</asp:Menu>
=============== ==============

======== in aspx page=========

<asp:Menu ID="Menu1" runat="server" DataSourceID="X mlDataSource1"
SkinID="Main">

</asp:Menu>
=============== ==========

We can see that we use "ImageUrl" property to specify theme specific path
for the Node and let other field still utilize databinding fields from xml
datasource.

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Mar 14 '06 #2
Ben
Ok, since dynamically configured ImageUrl's cannot be themed and I'm new to
2.0, is it possible to determine the current Theme directory to perform a
manual string concat in MenuItemDataBou nd?
Mar 14 '06 #3
DWS
Ben,
How about trying Skins?

DWS

"Ben" wrote:
Ok, since dynamically configured ImageUrl's cannot be themed and I'm new to
2.0, is it possible to determine the current Theme directory to perform a
manual string concat in MenuItemDataBou nd?

Mar 14 '06 #4
Thanks for your response Ben,

I think your idea is really cool, I did missed the "MenuItemDataBo und"
event, I've tested it and we can do this as long as we know the sub folder
structure under each Theme's folder. And the page's current Theme can be
got through Page.Theme property. For example, we can add our code in Menu's
MenuItemDatabou nd event handler as below:

=============== ======

protected void Menu1_MenuItemD ataBound(object sender, MenuEventArgs e)
{
string path;

switch(e.Item.D epth)
{
case 0:
path = Page.ResolveUrl ("~/App_Theme/" +Page.Theme +
"/Images/Menu/item.jpg");
break;
case 1:
path = Page.ResolveUrl ("~/App_Theme/" +Page.Theme +
"/Images/Menu/item1.jpg");
break;
case 2:
path = Page.ResolveUrl ("~/App_Theme/" +Page.Theme +
"/Images/Menu/item2.jpg");
break;

e.Item.ImageUrl = path;
}

}
=============== =======

BTW, you can also consider the approach in my last reply which make each
Theme's MenuItem databinding setting in the Theme also.

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Mar 15 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1578
by: Uriah | last post by:
I have a sort of critical problem that is driving users nuts. My site works fine when running over HTTP but when I switch to HTTPS, an error is generated every time a user mouses over one of the drop down menus. The error is 'This page contains both secure and nonsecure items. Do you want to display the nonsecure items?' and it is driving users nuts. There is definitely nowhere in my code that is referencing a resource over HTTP...
7
2688
by: Chuck Hartman | last post by:
I have a Windows service that requests web pages from a site using an HttpWebRequest object. When I try to request a page from an ASP.NET 2 site, I get a WebException with message "The remote server returned an error: (500) Internal Server Error." I found a post that suggested to catch the WebException to retrieve the actual HttpWebResponse object for more information. The response returned is shown below. At first I thought this was a...
2
9540
by: Kevin L. Kitchens | last post by:
Howdy... Been toying the the asp:menu object in order to dump the manually generated menu I've been using, however, I cannot seem to get the coloring to work properly. First off, what CSS tags should I be setting for how the menu is eventually rendered? spans? tables? td? div? In the example below I resorted to using inline coloring and still not
13
3346
by: Smith | last post by:
Hello, Does someone know a link to an example of customization of an asp:menu? Many thansk in advance. S
0
2093
by: jobs | last post by:
Hi. I have a menu horizontal on the top. I figured out that if I set this property the black arrow on parent items goes away.. StaticEnableDefaultPopOutImage="False" However, the item is still wider than other items accross than items
3
5351
by: kenny bones | last post by:
Hi! I'm currently working on a menu which is based on CSS and is listed with <li> tags. The CSS code looks like this: #nav { position: absolute; top: 101px; left: 390px; list-style: none; margin: 0; padding: 0;
3
2144
by: win | last post by:
I've create menu in a webform. <asp:Menu ID="Menu1" runat="server" CssClass="toolbar" Orientation="Horizontal"> <Items> <asp:MenuItem Text="Master" Value="Master"> <asp:MenuItem Text="Maintenance" Value="Maintenance"> <asp:MenuItem Text="Employee Maintenance " Value=" Employee Maintenance ">
0
4146
by: Mark B | last post by:
I have an asp:Menu control in vertical drop-down mode, a portion as displayed: Can anyone tell me how to get Community correctly aligned with Support? Also how do I put a bit of a gap between Community and its gray border? I have the following CSS which I purchased as part of a theme from www.aspthemes.net ...) /*-- ASP Menu --*/
0
2051
by: nzkks | last post by:
Hi, I am using these: ASP.Net 2.0, VB.Net, Visual Studio 2005, SQL Server 2005 In a asp.net page, I have two multiview controls each has 2 views & its corresponding 2 menu items named Metric & Imperial. Individually both works fine. But when I click "Metric", the other "Metric" should also be switched on and vice-versa for Imperial. How to achieve that? The catch here is, one of the multiview control is inside a show/hide div with...
0
8603
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9083
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8797
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8800
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5818
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4323
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1957
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.