You must Sign In to post a response.
  • Category: ASP.NET

    How to line break to asp button text

    Dear All,

    how to line break to asp button text
  • #750637

    I never tried this use below snippet for the same


    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #750644
    you can do that by setting width and css property. see below code:

    <style type="text/css">
    .wrap { white-space: normal; width: 100px; }
    <asp:Button ID="button1" runat="server" Text="some text to wrap" CssClass="wrap" />

    hope this helps you.

    If it helps you then Rate this.

    Best Regards,
    Manoranjan Sahoo

  • #750650
    Check out the below code it works in both Google Chrome and Mozilla firefox browser but it does not work in Internet Explorer.

    <asp:Button runat="server" id="btn" Text="hello

    hi" />

    Here it displays the hi text twice in separate lines with a line break.

    Miss. Jain
    Microsoft Certified Technology Specialist in .Net

  • #750661
    Try this code

    <asp:Button ID="btnDateTime1" runat="server" Text="Display Date Time" />
    <asp:Button ID="Button2" runat="server" Text="Display Date Time" />
    <asp:Button ID="Button3" runat="server" Text="Display Date Time" />

    Name : Dotnet Developer-2015
    Email Id :

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #750673

    You can use buttonid.text property and can use <br/> for this like below-

    <asp:Button ID="Button1" runat="server" />
    Button1.text=//your text

    Ashutosh Jha

  • #750676
    Hello venkat,

    Use word-wrap property with break-word in class
    I have posted snippet for you ,try it

    <asp:Button ID="btnSubmit" runat="server" Text="SOME TEXT TO SUBMIT BUTTON" CssClass="btnClass"/>

    CSS code

    .btnClass {
    word-wrap: break-word;
    width: 90px;

    If you have still an issue than i'll getback to you.

    Nirav Prabtani (Senior Web Developer)
    Email :
    blog :

  • #750681
    Have you tried HTML button \n does the task for you
    see below snippet

    <input type='submit' value='my \n button'>
    <input type="submit" value='top &#10; bottom'>

    You can use carriage return characters to break the line: but it support HTML 5 supporting browser only
    see below
    <input type="button" value="Really Tall Button">

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #765212
    If you are using ASP Button then add style to button as style="white-space:normal; padding:1px 2px 1px 2px;" and in code adjust space by html entity ( );

    btn1.text = Server.HtmlDecode("       Hello      This is my world");
    btn1.WIdth = 105;
    btn1.Height = 35;

    Hope this will work

  • #765213
    Please use HTML non breaking space code at the place of space in code. as much spaces that much add non breaking space.

  • Sign In to post your comments