[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Separater in asp:menu

Posted on 2011-05-11
8
Medium Priority
?
350 Views
Last Modified: 2012-06-27
Hi

I am using <asp:Menu/> control. Inside the control I have 4 links. Between the links I want  a separator '|'.

How can I achieve this?
Regards
Karan Gupta
0
Comment
Question by:KaranGupta
  • 3
  • 3
  • 2
8 Comments
 
LVL 21

Expert Comment

by:Alfred A.
ID: 35743872
Do you use a SiteMapDataSource?  If you are using Web.Sitemap, you could just add another sitemapnode with the "|" as the title.  For example check the sample sitemap below.  Also note that you should set SiteMapDataSource ShowStartingNode property to false to see the effect below and Menu Orientation set to Horizontal.

<?xml version="1.0" encoding="utf-8" ?>
<siteMap>
  <siteMapNode title="Home" description="Home" url="~/default.aspx">
    <siteMapNode title="Products" description="Our products"
      url="~/Products.aspx">
      <siteMapNode title="Hardware" description="Hardware choices"
        url="~/Hardware.aspx" />
      <siteMapNode title="Software" description="Software choices"
        url="~/Software.aspx" />
    </siteMapNode>
    <siteMapNode title="|" description="" url="" />
    <siteMapNode title="Services" description="Services we offer"
        url="~/Services.aspx">
      <siteMapNode title="Training" description="Training classes"
        url="~/Training.aspx" />
      <siteMapNode title="Consulting" description="Consulting services"
        url="~/Consulting.aspx" />
      <siteMapNode title="Support" description="Supports plans"
        url="~/Support.aspx" />
    </siteMapNode>
  </siteMapNode>
</siteMap>
0
 

Author Comment

by:KaranGupta
ID: 35743943
Hi Alfred1

I am not using any sitemapsource. I am using like this

<asp:MenuItem Text="link1"></asp:MenuItem>
<asp:MenuItem Text="link2"></asp:MenuItem>
<asp:MenuItem Text="link3"></asp:MenuItem>
<asp:MenuItem Text="link4"></asp:MenuItem>

Now if I add one <asp:menu Text="|"> between link1 and link2 then it will act as a separator as per your suggestion.  But the problem with this approach

1. If the put cursor on the separator I can see the hand cursor on it which is wrong as it should not act as a link.
2. If I apply hover style then it will apply to the separator as well.

Regards
Karan Gupta
0
 
LVL 21

Expert Comment

by:Alfred A.
ID: 35744014
Maybe you could just use a table.  For example see below.  Also, why do you have four menus when you could just use one menu and use a sitemapdatasource for the four links?


<table>
     <tr>
        <td>
            <asp:MenuItem Text="link1"></asp:MenuItem>
        </td>
        <td>|</td>
        <td>
            <asp:MenuItem Text="link2"></asp:MenuItem>
        </td>
         <td>|</td>
        <td>
            <asp:MenuItem Text="link3"></asp:MenuItem>
        </td>
         <td>|</td>
         <td>
            <asp:MenuItem Text="link4"></asp:MenuItem>
        </td
    </tr>
</table>

Open in new window

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 11

Expert Comment

by:Deepak Lakkad
ID: 35744341
Hi

Refer following menu with Separater

<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal">
            <Items>
                <asp:MenuItem Text="Home" Value="Home"></asp:MenuItem>
                <asp:MenuItem Text="|" Value="|"></asp:MenuItem>
                <asp:MenuItem Text="About Us" Value="About Us"></asp:MenuItem>
                <asp:MenuItem Text="|" Value="|"></asp:MenuItem>
                <asp:MenuItem Text="Services" Value="Services"></asp:MenuItem>
                <asp:MenuItem Text="|" Value="|"></asp:MenuItem>
                <asp:MenuItem Text="Products" Value="Products"></asp:MenuItem>
            </Items>
        </asp:Menu>

Open in new window


- Deepak Lakkad
0
 
LVL 11

Expert Comment

by:Deepak Lakkad
ID: 35744346
to keep separater disabled use following code

<asp:MenuItem Text="|" Value="|" Enabled="false"></asp:MenuItem>

- Deepak Lakkad
0
 
LVL 21

Expert Comment

by:Alfred A.
ID: 35744442
Oops. Ignore my previous post. I didn't realize MenuItems against Menu. So it is just one menu.
0
 

Author Comment

by:KaranGupta
ID: 35744971
Hi deepaklakkad

<asp:MenuItem Text="|" Value="|" Enabled="false"></asp:MenuItem>

works but there is one more problem. If the color of menu item is blank and if I disable it then it is changed to white color. Can I set the color of separator.

Regards
Karan Gupta
0
 
LVL 11

Accepted Solution

by:
Deepak Lakkad earned 2000 total points
ID: 35745039
Hi

Try this one

<asp:MenuItem Text="<span style='color:red'>|</span>" Value="|" Enabled="false"></asp:MenuItem>

- Deepak Lakkad
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month19 days, 10 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question