Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Sep 26, 2007 02:53 PM by anught
Sep 25, 2007 09:25 PM|LINK
I have a <TEXTAREA> server control on one of my asp.net web page. I want to fill this area by taking values from two variables which I am getting in my code behind file. I want to put a blue horizontal line between these two values. so let's say I have two
variable X = "Hello World" and Y = "Welcome to ASP.Net", so I wanto display text inside textarea as below:
so, let say my server TEXTAREA control is like this
<textarea id="txtArea" runat="server" rows="5" readOnly wrap="hard" cols="65"></textarea>
now if in my code behind file, I do following:
txtArea.Value = X + "<hr color=blue />" + Y
I get following output:
Hello world <hr color=blue /> Welcome to Asp.net
Can someone please help me how to achieve colored horizontal line in textarea between values of X and Y
Sep 26, 2007 12:22 AM|LINK
There are two ways I can think of to acheive this.
You can use two textareas and place a <hr> or stretched pixel or table or css or whatever element you want in between to serve as the "line" and format the textarea using css to achieve whatever look and feel you want, ie: no bottom border on the first teatarea
and no top border on the second textarea. Some form of this approach is probably better since it will preserve the seperation of the storage and optionally the edit of the two pieces of data while combining them for presentation.
The other way you could do it is to parse the information as HTML with a <hr> separator and present it to the user in the FreeTextBox control with a minimal toolset configuration, but then you would need to parse out the html to edit the data back to two
values. And the line would not be read only, ie: it could be deleted. Bad approach I think.
Souds like a kinda random specification. I hate those. I suggest the first approach. Two textareas and a bit of CSS should do the trick.
Sep 26, 2007 05:42 AM|LINK
its not possible to achieve this thing with textbox control. You can do this using label. [:)]
Sep 26, 2007 02:28 PM|LINK
i can not take two textarea control as my requirement is as soon as i finished displaying value of X, immediately after horizontal line, i display the value of Y also. if i take two textarea then i can not achieve this and there could be 3-4 lines of gap
between these two values.
Any more idea guys ?
Sep 26, 2007 02:53 PM|LINK
I told you how to avoid any extra lines by using CSS and someone else said you could use a label control, etc. You specified TEXTAREA control but it only displays plain text, not html required for your horizontal rule.
You should review the previous replies, they contain your answer. If you MUST use a textarea control for some weird random reason, I gave you two viable options. If you don't need to use TextArea (does the data need to be submitted?) then use labels and
an <HR> or equivalent.