Link to home
Start Free TrialLog in
Avatar of Victor  Charles
Victor CharlesFlag for United States of America

asked on

Help with making scroll bar invisbile

Hello,

I set my textbox mode to  TextMode="MultiLine" in order to add multiple rows in my text box, but since the size of my text box is large enough i do not nee to see the scroll bar, is there a way to make it invisible?

Victor
Avatar of Rose Babu
Rose Babu
Flag of India image

since the size of my text box is large enough
so, in your case you can set style="overflow:hidden" to the textbox.

and additionally you can restrict the user to enter more than the allowable text in the text box by adding the mentioned script below.

and also i added a custom attribute to the textbox as MyMaxLength to set the maxlength value.
<script type="text/javascript">
	function CheckMaxLength(e, TextBox) {
		switch (e.keyCode) {
			case 37: // left
				return true;
			case 38: // up
				return true;
			case 39: // right
				return true;
			case 40: // down
				return true;
			case 8: // backspace
				return true;
			case 46: // delete
				return true;
			case 27: // escape
				TextBox.value = '';
				return true;
		}
		return (TextBox.value.length < TextBox.getAttribute("MyMaxLength"));
	}
</script>

<asp:TextBox ID="TextBox2"
     runat="server" 
     TextMode="MultiLine" 
     Height="130px" 
     Width="300px" 
     style="overflow:hidden;"
     MyMaxLength="12"
     onkeypress="return CheckMaxLength(event, this);" >
</asp:TextBox>

Open in new window

Hope this will work for you.
Avatar of Victor  Charles

ASKER

Thank you it worked, regarding your script that controls length of text entered, is there a way to use the same one for multiple textboxes or do I need to call s different script for each textbox? I have about 36 textboxes in my application.
ASKER CERTIFIED SOLUTION
Avatar of Rose Babu
Rose Babu
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks , I will try it and get back to you.
any luck?