Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Help with making scroll bar invisbile

Posted on 2012-03-16
5
Medium Priority
?
234 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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 have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

971 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