Solved

Help with making scroll bar invisbile

Posted on 2012-03-16
5
225 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

821 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