Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

Displaying a horizontal rule in an asp:Textbox

Question posted by: silpa (Newbie) on July 3rd, 2008 11:06 AM
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.NewLine + "<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
insertAlias's Avatar
insertAlias
Moderator
1,460 Posts
July 3rd, 2008
01:38 PM
#2

Re: Displaying a horizontal rule in an asp:Textbox
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.

Reply
nmsreddi's Avatar
nmsreddi
Needs Regular Fix
365 Posts
July 4th, 2008
04:07 AM
#3

Re: Displaying a horizontal rule in an asp:Textbox
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

Reply
Reply
Not the answer you were looking for? Post your question . . .
189,285 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top .NET Forum Contributors