IT Community - Software Programming, Web Development and Technical Support

Creating image based site navigation using standard sitemap

This is a discussion on Creating image based site navigation using standard sitemap within the C# Programming forums, part of the Software Development category; Creating image based site navigation using standard sitemap Could you please help with this ? <siteMap xmlns="http://schemas....


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 08-08-2007, 09:53 PM
H2o H2o is offline
D-Web Analyst
 
Join Date: Jul 2007
Posts: 245
H2o is on a distinguished road
Thumbs up Creating image based site navigation using standard sitemap

Creating image based site navigation using standard sitemap

Could you please help with this ?

<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/Default.aspx" title="Home" imageName="buttons_01.jpg" description="">
<siteMapNode url="~/Auction.aspx" title="Food Auction!" description="Food Auction! (number one in the world)" imageName="buttons_02.jpg"/>
<siteMapNode url="~/Start.aspx" title="Find and Order" description="Find and order your food." imageName="buttons_03.gif">
<siteMapNode url="~/Search.aspx" title="Find Restaurant" description="Find your food." imageName="buttons_03.gif"/>
</siteMapNode>
</siteMapNode>
</siteMap>


<asp:SiteMapDataSource ID="srcBuckets" runat="server" ShowStartingNode="False" />


<ul>
<li><asp:HyperLink runat="server" ID="lnkHome" ImageUrl='./images/buttons_01.jpg' NavigateUrl="~/Default.aspx">Home</asp:HyperLink></li>

<asp:Repeater runat="server" ID="menu" DataSourceID="srcBuckets" EnableViewState="false">
<ItemTemplate>
<li>
<asp:HyperLink ID="HyperLink1" runat="server" ImageUrl='./images/<%# Eval((SiteMapNode)Container.DataItem)["imageName"]) %>' NavigateUrl='<%# Eval("Url") %>'> <%# Eval("Title") %></asp:HyperLink>

<asp:Repeater ID="Repeater1" runat="server" DataSource='<%# ((SiteMapNode) Container.DataItem).ChildNodes %>' EnableViewState="false">
<HeaderTemplate>
<ul>
</HeaderTemplate>

<ItemTemplate>
<li>
<asp:HyperLink ID="HyperLink2" runat="server" ImageUrl='images/<%# ((SiteMapNode)Container.DataItem))["imageName"] %>;' NavigateUrl='<%# Eval("Url") %>'> <%# Eval("Title") %></asp:HyperLink>
</li>
</ItemTemplate>

<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>

I appreciate if you share any information that you might think it will help me.
__________________
H2O

Without us, no one can survive..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 08-08-2007, 10:00 PM
garunprasad garunprasad is offline
D-Web Trainee
 
Join Date: Mar 2007
Location: Chennai
Posts: 45
garunprasad is on a distinguished road
Send a message via ICQ to garunprasad Send a message via AIM to garunprasad Send a message via MSN to garunprasad Send a message via Yahoo to garunprasad Send a message via Skype™ to garunprasad
Thumbs up Re: Creating image based site navigation using standard sitemap

hey,

You can set the text of the menuitem to image control, for example:
<asp:MenuItem ToolTip="Home" Text="<img runat='server' src='../../image/button-search.gif' />" Value="Home" NavigateUrl="~/Menu/Menu.aspx" >
Then the menuitem's text will be repalce with an image.

Hope it helps.
__________________
G.A.P
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 08-08-2007, 10:05 PM
H2o H2o is offline
D-Web Analyst
 
Join Date: Jul 2007
Posts: 245
H2o is on a distinguished road
Question Re: Creating image based site navigation using standard sitemap

hey,

Thanks, but I want to use SiteMap xml file, this is kind of hard coded right ?
i need something more dynamic ?
__________________
H2O

Without us, no one can survive..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 08-08-2007, 10:11 PM
Venkat Venkat is offline
D-Web Master
 
Join Date: Mar 2007
Posts: 347
Venkat is on a distinguished road
Thumbs up Re: Creating image based site navigation using standard sitemap

hey,

I used the sitemap xml file and set a custom property of "ImageUrl" (Sample code below). After that I used the menuitemsdatabound event and assigned the SiteMapNodes's ImageUrl value to the MenuItems ImageUrl property. Let me know if this helps.

//Sitemap example
<siteMapNode>

<siteMapNode title="Support" url="#Support" ImageUrl="Images/mnu_support.jpg"></siteMapNode>

<siteMapNode title="Downloads" url="#Downloads" ImageUrl="Images/mnu_downloads.jpg"></siteMapNode>

<siteMapNode title="Purchase" url="#Purchase" ImageUrl="Images/mnu_purchase.jpg"></siteMapNode>

<siteMapNode title="Activation" url="#Activation" ImageUrl="Images/mnu_activation.jpg"></siteMapNode>

</siteMapNode>

//MenuItemDataBound Example
Dim node As SiteMapNode = CType(e.Item.DataItem, SiteMapNode) //Gets the current node
If node("ImageUrl") IsNot Nothing Then //Checks if the node has a ImageUrl property assigned
e.Item.ImageUrl = node("ImageUrl") //Assigns the SiteMapNode ImageUrl to the MenuItem ImageUrl property
e.Item.Text = String.Empty //This code removes the text from the SiteMap Node. This could possibly also be done by leaving the Title property empty for the SiteMapNode
End If
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 08-08-2007, 10:12 PM
H2o H2o is offline
D-Web Analyst
 
Join Date: Jul 2007
Posts: 245
H2o is on a distinguished road
Thumbs up Re: Creating image based site navigation using standard sitemap

hey,


What would be the code in C# ?
__________________
H2O

Without us, no one can survive..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 08-08-2007, 10:12 PM
Venkat Venkat is offline
D-Web Master
 
Join Date: Mar 2007
Posts: 347
Venkat is on a distinguished road
Thumbs up Re: Creating image based site navigation using standard sitemap

hey,

here is the code in C#

protected void MenuItemDataBound(object sender, System.Web.UI.WebControls.MenuEventArgs e)
{
MenuItem item = (MenuItem)e.Item;
SiteMapNode node = (SiteMapNode)item.DataItem;

if (node("ImageUrl") != null)
{
item.ImageUrl = node("ImageUrl");
item.Text = string.Empty;
}
}
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2003 Style Navigation Pane Sundaram ASP and ASP.NET Programming 13 11-10-2008 10:22 PM
Google Publishes A Sitemap FAQ vadivelanvaidyanathan Google 1 01-25-2008 01:57 PM
Product-based Company and Projects-based Company : vigneshgets Software Testing 0 01-15-2008 10:03 PM
Creating easy site wide links through css bermuda HTML, CSS and Javascript Coding Techniques 0 10-12-2007 04:18 AM
Creating a site from scratch or with a CMS? oyu2o Web Design Help 2 03-15-2007 01:02 PM


All times are GMT -7. The time now is 11:06 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0