我想通过补空格的方式,进行对齐,但是补不上,只有一个空格,其它的被截断了,请问该怎么办?谢谢
            foreach (var cat in cateTeam.SubCategories)
            {
                if (cat.IsMagazine.HasValue && cat.IsMagazine.Value)
                {
            @Html.ActionLink(cat.Name, "Magazine", "Lib", new RouteValueDictionary { { "id", cat.ID } }, null);       //杂志类型
                }
                else
                {
            @Html.ActionLink(cat.Name, "Category", "Lib", new { id = cat.ID }, new { target = "_blank", title = cat.Name })  //一般分类
                }                counter6 = counter6 + 1;
                if (counter6 % 6 == 0)
                {
            <br />
                    counter6 = 0;
                }
                else
                {
                    string strTemp = string.Empty;
                    int length = cat.Name.Length;
                    @strTemp.PadRight(15 - length, ' ');
            
                }
            }

解决方案 »

  1.   

    上边的问题还没有解决,但是解决了中英文混编的情况,很简单,参考下边链接中文章。http://www.cnblogs.com/Pickuper/articles/2059139.html
      

  2.   

    想起他办法,用div来布局,不用补空格。
        <div>
            @foreach (var cat in Model.CateFather)
            {
            
                if (cat.IsMagazine.HasValue && cat.IsMagazine.Value)
                {
                <div style="width:200px;float:left">
                @Html.ActionLink(cat.Name, "Magazine", "Lib",new { id = cat.ID }, new { target = "_blank", title = cat.Name });
                </div>
                }
                else
                {
                    continue;//@Html.ActionLink(cat.Name, "Category", "Lib", new { id = cat.ID }, new { target = "_blank", title = cat.Name })  //一般分类
                }
                
                counter6 = counter6 + 1;
                if (counter6 % 6 == 0)
                {
                <br />
                    counter6 = 0;
                }        }
        </div>