Displaying a horizontal rule in an asp:Textbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • silpa
    New Member
    • May 2007
    • 20

    Displaying a horizontal rule in an asp:Textbox

    Hi,

    I have created a new web application in asp.net.I am using VS 2008.
    In the web form,I have placed a textbox and a button.

    In the button click event,I have written as follows:

    TextBox1.text=" abc"+ Environment.New Line + "<hr>";

    I want to get the output as (abc and a horizontalrule in the textbox)
    abc
    --------------------------------------------------


    But I am getting as follows.
    abc
    <hr>


    Please help me regarding this.

    Thanks,
    Silpa
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    As far as I know text boxes can't display HTML code, just text. If you want something like that, you'll need to use Rich Text.

    Comment

    • nmsreddi
      Contributor
      • Jul 2006
      • 366

      #3
      Hello

      Literal control in ASP.net can display line by using <hr> tag,

      just use this

      Literal1.Text = "ABC" + "<hr>";

      hope may solve your problem

      Comment

      Working...