Solved

Help with making scroll bar invisbile

Posted on 2012-03-16
5
223 Views
Last Modified: 2012-03-30
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
0
Comment
Question by:vcharles
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:Rose Babu
ID: 37732549
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.
0
 

Author Comment

by:vcharles
ID: 37733243
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.
0
 
LVL 16

Accepted Solution

by:
Rose Babu earned 500 total points
ID: 37736152
you can call the same script for all 36 text boxes.

just add the MyMaxlength and onkeypress attribute to all text boxes.
<asp:TextBox ID="TextBox2"
     runat="server" 
     TextMode="MultiLine" 
     Height="130px" 
     Width="300px" 
     style="overflow:hidden;"
     MyMaxLength="12"
     onkeypress="return CheckMaxLength(event, this);" >
</asp:TextBox>

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

Open in new window

Try this. it will work.
0
 

Author Comment

by:vcharles
ID: 37736409
Thanks , I will try it and get back to you.
0
 
LVL 16

Expert Comment

by:Rose Babu
ID: 37756800
any luck?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This video discusses moving either the default database or any database to a new volume.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now