Menu Bug Fix (litMenuHtmlTail.Text)


Author Message
Cecil

Posted: 12/15/2009
Quote message 

:-(

Before I go on I want to say how well done I feel Artisteer is. The Office 2007 look and feel is very intuitive. The features available are excellent. And the code it outputs is about 10 billion times better than any auto-generated stuff I've ever seen.

As a former web/SQL developer who has moved into the management game, I have a great need for time saving products such as Artisteer and DNN. I've only recently jumped into both and have quite a professional site running in under 48 hours. Kudos all the way around.

That said... Had a problem with the ArtMenuSO.ascs.vb (code behind) file that Artisteer generated for me today. It manifested itself with several of the modules installed on my site as well as some of the Admin containers. I haven't got time to track down the core issue. But it appears to me that when only the container contents was updated during a submit, the "litMenuHtmlTail" object in the ArtMenuSO web control was generating additional markup unecessarily (</ul></div></div>). With each subsequent postback the output would have 3 additional tags inserted into the HTML.

First post back would cause the container to grow beyond the main content <Div> of the page. Basically it would stretch to 100%. The second postback would cause the container to disappear altogether. Clicking the menu link to take me back to the main page of the module would take me back to square 1. Likely because the entire page was refreshed, not just the container.

Again, I don't have time to dive into this more thoroughly. So I'm probably missing a much more elegant solution than what I'm going to post below. I did manage to correct the behavior without negative impact. And I'm hoping that if this is a bug rather than an end user error, well someone may be helped out by the code modification below.

Skin Template HTML:
[Code]<dnn:ARTMENU
ID="ArtMenu1"
ShowHiddenTabs="False"
ShowAdminTabs="True"
ShowDeletedTabs="False"
ShowLoginTab="False"
ShowUserTab="False"
runat="server" />
<div id="TopPane" visible="false" runat="server"></div>
<table class="position" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td width="33%" id="Top1" runat="server"></td>
<td width="33%" id="Top2" runat="server"></td>
<td id="Top3" runat="server"></td>
</tr>
</table><div class="art-contentLayout">
<div class="art-sidebar1">
<div id="sidebar1" visible="true" runat="server"></div>
</div>
<div class="art-content<%= CollapseSidebars() %>">
<div id="Banner1" visible="false" runat="server"></div>
<table class="position" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td width="50%" id="User1" runat="server"></td>
<td id="User2" runat="server"></td>
</tr>
</table>
<div id="Banner2" visible="false" runat="server"></div>
<div id="ContentPane" runat="server"></div>
<div id="Banner3" visible="false" runat="server"></div>
<table class="position" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td width="50%" id="User3" runat="server"></td>
<td id="User4" runat="server"></td>
</tr>
</table>
<div id="Banner4" visible="false" runat="server"></div>
</div>

</div>
<div class="cleared"></div>
<table class="position" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td width="33%" id="Bottom1" runat="server"></td>
<td width="33%" id="Bottom2" runat="server"></td>
<td id="Bottom3" runat="server"></td>
</tr>
</table>
<div id="BottomPane" visible="false" runat="server"></div><div class="art-Footer">
<div class="art-Footer-inner">
<div class="art-Footer-text">
<p>Copyright &copy 2010 <a href="http://www.prudential.com">Prudential Financial, Inc.</a></p>

</div>
</div>
<div class="art-Footer-background"></div>
</div>

<div class="cleared"></div>
</div>
</div>
<div class="cleared"></div>
<p class="art-page-footer"></p>
</div>


<dnn:STYLES runat="server" ID="style" Name="style" StyleSheet="style.css" UseSkinPath="true" />
<dnn:STYLES runat="server" ID="styleIE6" Name="styleIE6" Condition="IE 6" StyleSheet="style.ie6.css" UseSkinPath="true" />
<dnn:STYLES runat="server" ID="styleIE7" Name="styleIE7" Condition="IE 7" StyleSheet="style.ie7.css" UseSkinPath="true" />[/Code]

Code Causing Problem in the Web Control "ArtMenuSO.ascx.vb"
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Try
Me.litMenuHtml.Text = GetMenuHtml()

If Me.ShowLoginTab Or Me.ShowUserTab Then
Me.litMenuHtmlTail.Text = "</li>"
End If

If Me.ShowLoginTab And Me.ShowUserTab Then
Me.litMenuTokensSeparator.Visible = True
Me.litMenuTokensSeparator.Text = "</li><li>"
End If

Me.litMenuHtmlTail.Text &= "</ul></div></div>" [/Code]

Fix: Use an IF statement to check for the closing tags
                If Me.litMenuHtmlTail.Text = "" Then

Me.litMenuHtmlTail.Text &= "</ul></div></div>"
End If


See, not quite elegant. But it works. So if you're containers are breaking contain, this might be the reason why. Either that or I simply installed the skin incorrectly. Ciao
 
Steven Webster

Posted: 12/17/2009
Quote message 

Cecil,
Nice job. This is a documented issue and one that for some reason is still in the latest release. Here is another thread and "official" fix from support. Bascially...they added am IsPostBack clause in the PageLoad event

http://www.artisteer.com/?post_id=118535&p=forum_post&forum_id=24