Welcome Guest Search | Active Topics | Sign In | Register

Databound Menu - Separator between bound items Options
Afflicted
Posted: Thursday, September 13, 2007 4:02:35 PM
Rank: Advanced Member
Groups: Member

Joined: 9/13/2007
Posts: 51
Hello all,

I first created my menu manually to get it to look and feel how I wanted. Now I am databinding to it but I have not been successful in figuring out how to add a separator between each databound item.

For instance:

I want this -> Common Tasks | About Us | Contact Us

The "|" is the separator

What I get is -> Common Tasks About Us Contact Us

Any ideas?
eo_support
Posted: Thursday, September 13, 2007 4:51:41 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi,

Our menu doesn't recongize '|' or '-', in order to create a separator during data binding, you would need to handle ItemDataBound event, at which point you can set the newly created item's IsSeparator to true base don Menu.DataItem. DataItem contains the current "data item" that was used to create the menu item.

Thanks
Afflicted
Posted: Thursday, September 13, 2007 5:13:09 PM
Rank: Advanced Member
Groups: Member

Joined: 9/13/2007
Posts: 51
Cool, thanks. I didn't see the events as I was looking at the TemplateItem, instead of the Menu itself... DUH!
Afflicted
Posted: Friday, September 14, 2007 8:30:27 AM
Rank: Advanced Member
Groups: Member

Joined: 9/13/2007
Posts: 51
So do you mean that I would need to have separator items in my datatable in order to use them with the databound menu?

I.E. My table would need to look like this:

Item 1 -> Common Tasks
Item 2 -> |
Item 3 -> About Us
Item 4 -> |
Item 5 -> Contact Us

Or could my datatable look like this:

Item 1 -> Common Tasks
Item 2 -> About Us
Item 3 -> Contact Us

?
eo_support
Posted: Friday, September 14, 2007 8:35:42 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
You do not have to have separator physically in your database. But you definitely need something in your data source if you want to do it through data binding. If you bind it to db, then each item is created based on a "record", separator is also an item, so the record has to be there.
Afflicted
Posted: Friday, September 14, 2007 9:58:51 AM
Rank: Advanced Member
Groups: Member

Joined: 9/13/2007
Posts: 51
I have added the separator "|" to my datatable via c# code, however it still does not display when I set IsSeparator = true for the items that have "|" for their text.

If I don't set the IsSeparator attribute then it shows.

What am I doing wrong?
eo_support
Posted: Friday, September 14, 2007 10:51:24 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hum....then probablly a regular item will work just fine for you. :) There are generally two ways to display a separator, using the build in separator support; or use regular menu items. When you use built-in separator support, you would need to set properties on LookItems._Separator in order to control how your separator would look like. The otherwise is to use a regular item, you can use the pipe character "|" or even an image. It will display whatever you provide.

The biggest difference between "separator item" and "non separator item" is separator use a different look item (LookItems._Separator), it also can not have left/right images.
Afflicted
Posted: Friday, September 14, 2007 1:53:45 PM
Rank: Advanced Member
Groups: Member

Joined: 9/13/2007
Posts: 51
I have not been successful in getting either method to work.

My results: When I use a regular menu item with "Text-Html='|'" it makes that menu item the same width as my other menu items (about 147 pixels too wide). I was not successful in finding out where to set the _Separator LookItem in the code-behind. I found where I could set it within the Menu Builder but that didn't seem to work for me either.

Any ideas?
Afflicted
Posted: Friday, September 14, 2007 2:01:09 PM
Rank: Advanced Member
Groups: Member

Joined: 9/13/2007
Posts: 51
I got it to work using a regular menu item. The problem was that it was not taking the width of 1px that I had set in the CSS file. I had to set MenuItem.Width = 1 for it to work.
eo_support
Posted: Friday, September 14, 2007 2:14:52 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Cool! You are absolutely right --- it does not take the width set in CSS, that's exactly why we have a separate Width property. :)


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.