CodeVerge.Net Beta


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

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 11/29/2005 8:49:08 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 4 Views: 51 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
5 Items, 1 Pages 1 |< << Go >> >|
GregoryD
Asp.Net User
Asp:Menu Image Backgrounds11/29/2005 8:49:08 PM

0/0

I have been playing around with this for some time now and can't figure it out...

I have an ASP:Menu control which pulls from the  web.sitemap file.  I want an image to be the background for each item -- it's a gradient ala the Outlook 2003 menu. 

Since there aren't any properties for "background-image" in any of the Static***Styles I set the "StaticMenuItemStyle" CssClass equal to a class I've created in my stylesheet.  In the stylesheet I set the background image appropriately.  When I run the site, I get the effect I'm going for but if I look closely I also see the gradient image directly behind the text of the link.

For instance, my HOME link, in the small space that HOME takes up, you can see the gradient there, just not stretched out.  So it looks dumb because I have the effect I want but also a little gradient box which the text is in. I've tried everything I can think of but I can't seem to get to the properties that directly affect the A:link, A:visited, A:hover properties for the links.

Does anyone have any work-around ideas for this?

Thanks!
Greg
www.theminesonline.com
GregoryD
Asp.Net User
Re: Asp:Menu Image Backgrounds11/29/2005 9:03:34 PM

0/0

Sorry... false alarm.  It must have been my computer.  I changed the display properties and went to 800x600 and it displayed fine. Then when I went back to 1024 x 760 it looked fine.  I must be losing my mind.

Greg


www.theminesonline.com
dannychen
Asp.Net User
Re: Asp:Menu Image Backgrounds11/29/2005 10:19:44 PM

0/0

A menu item sort of looks like this when rendered out:

<table>
<tr><td>
  <a>link text</a>
</td></tr>
</table>

The StaticMeuItemStyle CssClass gets applied in two places: the table and the anchor.  In your case, you would only like the class to be applied to the table.  To do that you can limit the effect in your CssClass.

<StaticMenuItemStyle CssClass="smis" />

and in css:

.smis table
{
  styles here only get applied to the table
}

.smis a
{
 styles here only get applied to the anchor
}

Let me know if this helps.
--
Danny
disclaimer: Information provided is 'as is' and conveys no warranties or guarantees.
Mini_bug
Asp.Net User
Re: Asp:Menu Image Backgrounds11/30/2005 1:51:31 PM

0/0

Under ASP.NET 2.0 (c#)
1.Modify your "Web.sitemap" like this:
<siteMap>
  <siteMapNode id="0" title="Home" description="Home" url="Default.aspx" target="_blank" img="~/images/home.gif">
    <siteMapNode id="1"  title="Sky's Program" description="Sky's Program" url="DefaultSky.aspx" ico="">
      <siteMapNode id="2"  title="Country" description="Area Setting" url="AreaSetting.aspx" />
    </siteMapNode>
    <siteMapNode id="3"  title="Tiger's program" description="Tiger's program" url="DefaultTiger.aspx">
      <siteMapNode id="4"  title="My program" description="Gateway Setting" url="GateWaySetting.aspx" />
      <siteMapNode id="5"  title="Others" description="Other Setting" url="Others.aspx" />
    </siteMapNode>
</siteMapNode>
2.Create a WebForm and add a Menu control: Menu1
3. Add the code below in your codefile:

protected void Menu1_MenuItemDataBound(object sender, MenuEventArgs e)
    {
        SiteMapNode mapNode = (SiteMapNode)e.Item.DataItem;
        //handle the target attribute of a url
        if (mapNode["target"] != null) 
        {
            e.Item.Target = mapNode["target"];
        }

        //if img is not null ,show the img instead of text
        if (mapNode["img"] != null)
        {
            e.Item.Text = "";
            e.Item.ImageUrl = mapNode["img"];
        }
        //do not display this menu
        if (mapNode["visibal"] == "0")
        {
           e.Item.Text = ""; 
         
        }
        //disable this menu
        if (mapNode["enable"] == "0")
        {
            e.Item.Enabled = false;
        }

        //do other if ....
    }

you can difine many attributes,just its value when the webcontrol bind the data.  ^_^

GregoryD
Asp.Net User
Re: Asp:Menu Image Backgrounds12/1/2005 8:44:01 PM

0/0

Danny, even though this did start working for me, thanks for the information on how the styles are applied.  This will be very helpful.

Greg


www.theminesonline.com
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Inside Dreamweaver UltraDev 4 Authors: Sean Nicholson, Pages: 456, Published: 2001
Beginning ASP.NET 2.0 Databases: Beta Preview Authors: John Kauffman, Thiru Thangarathinam, Pages: 427, Published: 2005
Dreamweaver MX 2004: The Missing Manual Authors: David Sawyer McFarland, David Pogue, Pages: 836, Published: 2004
Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages Authors: Jacob J. Sanford, Pages: 474, Published: 2007
Beginning Web Programming with HTML, XHTML, and CSS Authors: Jon Duckett, Pages: 840, Published: 2004
Mastering Web Development with Microsoft Visual Studio 2005 Authors: John Paul Mueller, Pages: 822, Published: 2005
ASP.NET: Tips, Tutorials, and Code Authors: Scott Mitchell, Pages: 878, Published: 2002
Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter Kit: visual web developer 2005 express edition starter kit Authors: David Sussman, Alex Homer, Pages: 312, Published: 2005
Mastering ASP.NET with C# Authors: A. Russell Jones, Pages: 816, Published: 2002
Programming a Real Internet Site with ASP and HTML: Book I: HTML and Basic ASP Authors: Marcelo Bosque, Pages: 167, Published: 2003

Web:
background image for menu control in ASP.NET 2.0? Talk about background image for menu control in ASP.NET 2.0?
ASP.NET 2.0 Menu control - background image? : menu, background ... Ok, I know I may be just overlooking something, so bear with me. I'm trying to do a simple horizontal menu (Dynamic) for a web site for which I want to have ...
Problem with asp menu (background image of MenuItem) Problem with asp menu (background image of MenuItem). microsoft.public.dotnet. framework.aspnet. Author. 16 Nov 2006 11:42 AM. sthrudel ...
Problem with asp menu (background image of MenuItem) - .NET ASP Problem with asp menu (background image of MenuItem). Get answers to your questions in our .NET ASP forum.
Background image for a asp.net menu - ASP.NET Forums asp.net Menu control works well with css background or background-image, since your css files are usually put into App_Themes/ThemeName/ ...
css background-image and menu control - ASP.NET Forums I have a static menu with each items having different image and different background image when I tried this with menu control I was unable ...
SitePoint Forums - Background image with menu control asp.menu background images using staticstylesheets - DevX.com Forums asp.menu background images using staticstylesheets ASP.NET. ... I am trying to create a asp.net 2.0 menu with a background image using ...
Background color of menu item in asp.net Hai, How to change the background colour of menu item on its click in asp.net ... SeparatorImageUrl="~/images/LineImage.bmp"> ...
Feedback: Can't set background image on menu items that is selected I'm trying to set different images, on , on static menu items if ... we can consider adding a more graceful way to support the background image. ...




Search This Site:










vs.net design view - all controls disappeared

testing asp.net application using vs 2005

deplyment - publish website. how to prevent upload of directories

installation of vs 2003 and 2005 together! is it possible?

css style sheet can't display backgroud-image at page designer

intellisense only working when i press on alt+right arrow

q: vs2005: connect to ftp server

my vs2005 does not save

vs.net 2005 professional and vwd express installed on same machine?

asking for administrative password

design view is disable

problems pointing asp.net to sql server 2005

simple data binding to gridview - showing blank rows

vs 2005 sp1 .designer.vb auto generated comments

single page assemblies

unit tests in asp.net

cannot reference web service methods

strategic view of c# code

needed: safari.browser file...

help-images do not show in vs 2005 but do when published

references problems

lines of text in output window are truncated to 256 characters

vs 2005 control event question

aspnet_compiler generates dlls with random 8 char names

neutralizing lines

can't drag items on page into table cells

compatable server?

asp.net 1.1 application using vs 2005

visual studio 2005 beta 1 back order

error with using for xml in vs & sql express

  Privacy | Contact Us
All Times Are GMT