Asp.net Mvc helper method

2 posts, 0 answers
  1. Danny
    Danny avatar
    1 posts
    Member since:
    Mar 2009

    Posted 07 Nov 2013 Link to this post

    Just code tell me the following code has some errors, please see the comments in the attached screen shots:

    @helper RenderMenuItemTreeNode(MenuItemTreeNode treeNode)
    {
        if (treeNode == null)
        {
            throw new ArgumentNullException("treeNode");
        }
        if (!treeNode.Visible)
        {
            return;
        }
        if (treeNode.IsSeperator)
        {
        <li class="divider"></li>
            return;
        }
        var active = treeNode.IsActive ? "active" : null;
        if (treeNode.ChildNodes.Count == 0)
        {
        <li class="@active"><a href="@treeNode.Url" target="@treeNode.Target">@treeNode.Name</a></li>
        }
        else
        {
            if (treeNode.ParentNode == null)
            {
        <li class="dropdown @active">
            <a class="dropdown-toggle" data-toggle="dropdown" href="@treeNode.Url" target="@treeNode.Target">@treeNode.Name <b class="caret"></b></a>
            <ul class="dropdown-menu">
                @foreach (var childTreeNode in treeNode.ChildNodes)
                {
                    @RenderMenuItemTreeNode(childTreeNode)
                }
            </ul>
        </li>
            }
            else
            {
        <li class="dropdown-submenu @active">
            <a href="@treeNode.Url" target="@treeNode.Target">@treeNode.Name</a>
            <ul class="dropdown-menu">
                @foreach (var childTreeNode in treeNode.ChildNodes)
                {
                    @RenderMenuItemTreeNode(childTreeNode)
                }
            </ul>
        </li>
            }
        }
    }
  2. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 08 Nov 2013 Link to this post

    Hi Danny,

     Thanks for the detailed feedback.
    We are aware of these issues and we have them logged for fixing.
    I would suggest ignoring them until the fix arrives.
    Thanks.

    Regards,
    Zdravko
    Telerik
    Share what you think about JustCode with us, so we can help you even better! You can use the built-in feedback tool inside JustCode, our forum, or our JustCode feedback portal.
  3. DevCraft banner
Back to Top