网上通过json数据实现多级(最少要支持到5级)水平导航menu菜单很少,找到这段js程序来拼接字符串,只要能添加不同<ul>的class就可以实现多级导航,高手们帮该一下,如果能改成c#版本,就更爽了,自己先顶一下。

解决方案 »

  1.   

    c#自带导航控件的 你用c#就别拼字符串了getDom:function(a){
            if(!a){return ''}
            //var html='\n<ul class="这里为数据中的uid">\n';
            for(var i=0;i<a.length;i++){            //html+='<li class="hide"><a href="#">'+a[i].name+'</a>';
               html+='<li class="'+a.uid+'"><a href="#">'+a[i].name+'</a>';

                html+=this.getDom(this.groups[a[i].id]);
                html+='</li>\n';
            };
            html+='</ul>\n';
            return html;
        }虽然你说了ul  但是根据数据结构 明显是  li匹配 uid
      

  2.   

    使用javascript的字符串拼接就可以使用。 C#我就不知道了。