|
-
July 8th, 2010, 09:57 AM
#1
Problem with if statement
Hi There,
I'm new to C# and I have an expanding menu plugin for a cms.
I have an attribute called MaxLevels which is set to three, and I need to be able to use output certain code dependant on the level in the menu.
my code is as follows:
Code:
<immCore:ExpandingMenu id="ExpandingMenu1" ShowTopLevelPages="true" StartPage="0" MaxLevels="3" indent="5" runat="server">
<headertemplate>
<ul class="cornerBottomSmall">
</headertemplate>
<itemTemplate>
<li><span><a href="<%# Container.Link %>" title="<%# Container.Title%>"><%#Container.MenuTitle%></a></span>
<%# (((Container.Index+1 < Container.Menu.DataSource.Rows.Count) && Convert.ToInt32(Container.Menu.DataSource.Rows[Container.Index+1]["Level"])-1 <= Container.Level)||Container.Index+1 >= Container.Menu.DataSource.Rows.Count ) ? "</li>":""%>
</itemTemplate>
<selecteditemTemplate>
<li class="active"><span><a href="<%# Container.Link %>" title="<%# Container.Title%>"><%#Container.MenuTitle%></a></span>
</selecteditemTemplate>
<downLevelTemplate>
<ul>
</downLevelTemplate>
<upLevelTemplate>
<%if (ExpandingMenu1.MaxLevels == 3)
{ %>
</ul>
</li>
</ul>
</li>
<% }
else
{
%>
</ul>
</li>
<%} %>
</upLevelTemplate>
<footertemplate>
</ul>
</footertemplate>
</immCore:ExpandingMenu>
While it returns the correct code at level 3, it doesn't display properly at below level 3, though I suspect my code is actually not checking the level state and simply checking the integer value given to Max Levels.
Any pointers would be appreciated.
Many thanks
Scamp
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|