简体   繁体   中英

Panel Bar Text Spacing

The below snippet is not adding spacing as expected after each field I am adding to a PanelBar. I am using MVC 4 .net 4.5 Razor View Engine.

It Displays something like this

MyTitleNumber:1By:John Doe

I want

MyTitle   Number: 1   By:  John Doe

Or

   MyTitle

   Number: 1   By John Doe

How can I add correct spacing?

EDIT: The if is inside the Razor View

if (MyItem.Item != null)
{
branch.Add().Text(MyItem.Title + "    Number:" + MyItem.Number + "    By:" + MyItem.Name);
}

You can use

branch.Add().Text(htmlString).Encoded(false);

and use &nbsp; or a fixed width <span> in htmlString to create the whitespace. Also see http://docs.kendoui.com/api/web/panelbar#methods-append

Try something like below :

@Html.Raw(
    branch.Add()
        .Encoded(false)
        .Text(Myitem.Title + "<span>&nbsp;&nbsp;</span>" + "Number:" + Myitem.Number +
                              "<span>&nbsp;&nbsp;</span>" + "By:" + Myitem.Name))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM