MojoTreeView - Question/Issue

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
5/2/2012 3:04:22 AM
Gravatar
Total Posts 34

MojoTreeView - Question/Issue

Hi,

Due to the terrible HTML mark up of the standard .NET treeview, I decided to swap this out for the CSS friendly MojoTreeView.  I have two issues which I can't seem to solve.

When I first load the page I check it's not a post back and populate the treeview from the database, using a recursive call to pick up all the child nodes. The first time it loads it doesn't have the little plus signs to expand even though the settings are correct. However, if I click on a node, it posts back and the pluses appear....

The second issue is when it posts back it always collapses back to whatever the default expand depth was set at.  I assume that viewstate is working to some degree as It holds the data loaded from the database after a postback and I don't reload it.

If I keep everything exactly the same and change it to standard ASP.NET TreeView everything works exactly as expected :-(

I have looked at some of the CSS adapter demos on the web and I don't have the problem with their demos, any ideas?

Thanks

Matt

5/2/2012 10:54:34 AM
Gravatar
Total Posts 18439

Re: MojoTreeView - Question/Issue

Hi Matt,

The adapter for mojoTreeView has been highly modifed to meet our needs for site navigation and styling. It is possible that those changes have broken some postback stuff but I know also that the first version of the CSSFriendly adapter also had some postback problems with treeview that were supposedly solved in a newer version.

Using postback with menu or treeview is not something I recommend in general. Postback should not be used for navigation, postback is intended for processing form submissions and the classic pattern is to redirect out of postback after processing a form submission to avoind the problem of the browser refresh button causing a duplicate or second postback. Not getting out of postback can also cause problems for other features on a cms page that have logic based on if(!IsPostBack). 

One common solution for keeping a cms feature postback from affecting other features on a page has been to wrap it in an updatepanel. Unfortunately neither treeview nor menu work inside updatepanel. 

So my advice in general is avoid using the postback features of menu and treeview and we don't use them in mojoPortal.

One option if you really need to go that direction is that as of .NET 4 the Menu control has a new RenderingModeProperty to make it render as nested ul/li elements instead of tables, so potentially you could use <asp:Menu and use postback and style it like a treeview. Unfortunately they did not give the treeview the same treatment and it does not have that new property so CSS Adapter would still be needed.

If Menu doesn't work for you let me know and perhaps I can implement another TreeView control that uses the unmodified CSS Adapter.

Best,

Joe

5/3/2012 6:42:08 PM
Gravatar
Total Posts 34

Re: MojoTreeView - Question/Issue

Hi Joe,

Thanks for the detailed information.  I will have a look at the .NET menu control and see if that can be used for my needs, if not I will have a go at implementing the latest CSS adapter myself and let you know how either turn out.

I actually have my Treeview working correctly inside an update panel on the left, which manually refreshs a content panel in the middle with the selected data, whether I can get that to work with the adapter version remains to be seen....

Thanks as always for your help and I'll let you know the outcome.

Matt

5/3/2012 9:17:43 PM
Gravatar
Total Posts 34

Re: MojoTreeView - Question/Issue

Hi Joe,

I thought I'd give you an update to help anyone else should they get the same issue.

I implemented the standard adapter and just changed the name space so it didn't conflict with the Mojo portal changed  CSS Friendly files and now the pluses show straight away and the viewstate works perfectly, even in an update panel.

I obviously don't need you to now implement this in Mojo, however it might be a nice addition for future releases as you suggested, just as a nice to have if people require it.  Keep up the great work Joe!!

Matt

5/7/2012 3:18:36 PM
Gravatar
Total Posts 18439

Re: MojoTreeView - Question/Issue

Hi Matt,

fyi, in the latest code in the repository I added a new treeview <portal:FriendlyTreeView that uses the standard CSS Adapter.

Best,

Joe

5/7/2012 9:25:55 PM
Gravatar
Total Posts 34

Re: MojoTreeView - Question/Issue

Great work. I'm sure that will save a lot of people some time, until Microsoft put the time and effort into putting a RendoringMode on the standard TreeView.

I will probably change my code to use your implementation as whilst it will be identical to mine, it keeps everything neat and tidy and in one place :-)

Keep up the good work

Matt

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