Strange tree menu behavior

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
9/6/2007 3:52:44 AM
Gravatar
Total Posts 68

Strange tree menu behavior

Hi Joe,

Look at the demo site, I'va added two pages under Home, and one page under each of theese. If you press the second one, the first node is expanded. It's the same if pressing third and fourth node and so forth, its always the first one expanding. Its seems to work correctly if you update all the pages after you created them. I have locally tested on another skin and it's the same thing.

9/7/2007 8:28:18 AM
Gravatar
Total Posts 18439

Re: Strange tree menu behavior

Hi Christian,

I just tested here and it seemed ok to me maybe I don't understand the issue. Can you spell it out for me in steps to reproduce, expected behavior, actual behavior.

Thanks,

Joe

9/7/2007 8:58:04 AM
Gravatar
Total Posts 68

Re: Strange tree menu behavior

Hi Joe,

1. Go to http://demo.mojoportal.com/home.aspx

2. Press the second '+'-sign:

[+] Ny sida

[+] Ny sida

     Bill's Page

3. The first '+'-sign is expanded, when the second one should be expanded.

Thanks,

Christian

9/7/2007 5:36:02 PM
Gravatar
Total Posts 18439

Re: Strange tree menu behavior

Hi Christian,

I figured it out and will have the fix in svn later tonight. The issue only happens when you create 2 pages at the same level with the same name (which is a weird thing to do anyway for a real site).

When we find the selected node to expand we use a thing called valuePath which is a delimited list of TreeNode.Value leading down the tree to the page.

According to this page on msdn, if the treeNode.Value is null it will use the .Text property for the Value. So I thinking this case it is using the text and they are the same and at the same level and hence they have the same valuePath so it was just expanding the first node with a matching valuepath.

As this page mentions that each page at the same level must have a unique .Value so not having a uniquw value was the root cause of the bug.

I think since we were just doing simple DataBinding the .Value was not set so it was using the .Text as .Value as default behavior. So the Solution was to explicitly set the value in the DataBound event like this:

e.Node.Value = mapNode.Url;

giving it a more unique value for the .Value property so it can find the correct node to expand.

Thanks,

Joe

9/7/2007 5:58:09 PM
Gravatar
Total Posts 18439

Re: Strange tree menu behavior

I ended up using PageGuid.ToString() as the .Value instead of url because its possible to have pages with the same url.

Joe

9/8/2007 2:52:01 AM
Gravatar
Total Posts 68

Re: Strange tree menu behavior

Thanks for the info! Acually, when I read this I remember I had the same problem once with a ListControl where multiple items used Guid.Empty as Value. This also leads to the first one with this value beeing selected, strange I didn't think of that. Good solution!

Christian

You must sign in to post in the forums. This thread is closed to new posts.