Greetings,
I have a form where employees enter comments in a multiline textbox with a limit of 4000 characters. I have the rows set to 8 (obviously an arbitrary number).
When a supervisor looks at the comments the textbox is disabled so the employee comments cannot be modified.
The problem is when the data extends below row 8. Since the textbox is disabled the scrollbar cannot be moved and the supervisor cannot see all the comments. If I hide the textbox and databind to a label for the supervisor none of the line breaks are maintained and a well written paragraph turns into the biggest run on sentence ever…
Is there a way to enable the scroll bar leaving the text disabled?
Is there a way to preserve the structure of the entry in the label?
views:
962answers:
3
+2
A:
In supervisor mode, don't put the text into a textbox, put it in a label as you mentioned, with '.Replace("\n", "<br>")' in your code.
Alternatively, show the textbox without disabling it, and just disable the 'save' button. Put a note on the page saying that, "changes made here are not persistent" or something to that effect.
Aric TenEyck
2009-06-25 17:04:20
The Label/Replace worked like a charm...Set BorderStyle="Solid" BorderWidth="1" and it blends into the page...Thanks!!!
Dining Philanderer
2009-06-25 17:21:17
+1
A:
Put the text in a PRE tag, and apply overflow:scroll
to it.
Make sure to escape the text using Server.HtmlEncode
first.
EDIT: This will preserve spacing from the text box
SLaks
2009-06-25 17:35:30
+4
A:
Instead of disabling the textbox you should set the ReadOnly property to True. This keeps the scrollbars functional but doesn't allow modification of the textbox.
txtComments.ReadOnly = true;
Ahmad Mageed
2009-06-25 18:05:59