473,804 Members | 3,271 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

max length property are not work in textbox asp.net control

The max length property are not work in the Asp.Net TextBox control.

Expand|Select|Wrap|Line Numbers
  1. <asp:textbox ID="txComment"  MaxLength="20" Width="90%" Columns ="5" Height="100px" TextMode ="MultiLine" runat="server"></asp:textbox>
Nov 3 '10 #1
2 2649
"When the TextMode property of a textbox is set to Multiline the MaxLength property will not limit the maximum length of user input. This is due to the fact that multiline textboxes are rendered to the browser actually as a textarea which has no maxlenth property..."

you can achieve this by enabling javascript

Please visit http://forums.asp.net/t/1251514.aspx
for more details
Nov 5 '10 #2
jeffstl
432 Recognized Expert Contributor
If you really need multi-line you can also just check the total character count before you save it too (in code) using constants or some other validation if you want to stay away from javascript for whatever reason.

Since you have your max set to 20 though, I suspect you don't really need multiline ;)
Nov 19 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1652
by: Gerry Viator | last post by:
Hi all, I would like only a year in a range from 1950 to 2040 to be alowed in a textbox control. This doesn't seam to be working... Private Sub txtboxYear_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtboxYear.KeyDown
1
1436
by: sreenish | last post by:
Hi All, How can I change the boder color of a TextBox control? I am trying to crate a new control derived from TextBox with a new property BorderColor. I could not find a way to do this. Please help! Thanks, Sreenish
3
2853
by: MLH | last post by:
I'm having trouble pasting a VLS into a textbox control on FormB. FormB is open in form view. I'm trying to do it from a procedure running in FormA. I'm up against 2048-Char limits no matter how hard I try. Funny thing is, I can easily hilite, cut 'n paste into the control manually - no problem. I just can't accomplish it from within code.
2
2241
by: fabrice | last post by:
Hi, I have a trouble with my TextBox Control and it's ViewState in my form... The property for it, is FALSE as following : <form id="frmSearchBre4" runat="Server"> <asp:textbox id="myID" TabIndex="1" EnableViewState="false" MaxLength="50" runat="server" TextMode="SingleLine"> </asp:textbox>
0
1177
by: Flack | last post by:
Hey guys, I have read that the max length of a multiline TextBox control is 64K and of a single line TextBox control is only limited by the amount of memory of the user. Are those correct statements? So, take this code for example: StringBuilder sb = new StringBuilder(); for(int i = 1; i <= 70000; i++)
1
1154
by: varsha11 | last post by:
how to create textbox control array at design time. in VB6 we use index property of textbox control is there any property in .NET
7
2222
by: panks2007 | last post by:
Hi, The scrollbars property in one activex which works similar to scrollbars property of textbox control when click on the region between slilder and arrow its moving either end. so, how to make it move smoothly when click between Slider and arrow Pankaj
6
1739
by: Shelly | last post by:
In looking at the asp.net TextBox, I noticed that there is a property called "OnTextChanged". I tried to use this control to call a subroutine called "GetCompanyProperties". The field is the account number. When a user enters an account number and then tabs or points to another field, I want the subroutine called so that it can access the database and get the data fill out six other fields. Nothing happens when I enter the account...
7
14512
by: Ned White | last post by:
Is it possible to insert HTML codes to a textbox control ? I am reading HTML formated string from sql server but if i assign this value to Text property of TextBox, the format tags of HTML seems too... sample string value from database: <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 11pt; mso-bidi-font-weight: bold"> Sales Contract </SPAN></P> <SPAN style="FONT-SIZE: 11pt; mso-bidi-font-weight: bold">Paragraph...
1
2847
by: mahendra dubey | last post by:
Hi There I am working on my first WPF project.I have a TextBox control.In Binding property of this TextBox,I want to set ValidatesOnDataErrors=true. But if this TextBox is disabled then I want to set ValidatesOnDataErrors=false. I want to do all these things in Xaml.How can i do that(Can we bind ValidatesOnDataErrors to a property?).Any help will be appreciated. Thanks,
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10588
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.