Solved

Help with making scroll bar invisbile

Posted on 2012-03-16
5
230 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

615 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