Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.net textbox scrolling when disabled

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?

like image 675
DiningPhilanderer Avatar asked Nov 30 '22 20:11

DiningPhilanderer


1 Answers

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;
like image 187
Ahmad Mageed Avatar answered Dec 08 '22 00:12

Ahmad Mageed