473,398 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Limiting Multiline textbox

Hi,

Is there a way to limit this field, because "maxlength" seems to be working
only for singleline ?

thanx, Neven
Nov 18 '05 #1
6 1633
> Is there a way to limit this field, because "maxlength" seems to be
working
only for singleline ?

This is more of an HTML issue than a ASP.NET issue. A multiline textbox
renders as a TEXTAREA HTML element. This element has no maxlength property.
To limit the length of a multiline textbox you have to do this in the
postback handler. You can also use a java script function to validate the
length of a field client side.

Anders Norås
blog: http://dotnetjunkies.com/weblog/anoras/
Nov 18 '05 #2
I thought so, but why putting this property under textarea ...

Thanx, Neven
"Anders Norås" <an**********@objectware.no> wrote in message
news:er*************@TK2MSFTNGP10.phx.gbl...
Is there a way to limit this field, because "maxlength" seems to be
working
only for singleline ? This is more of an HTML issue than a ASP.NET issue. A multiline textbox
renders as a TEXTAREA HTML element. This element has no maxlength

property. To limit the length of a multiline textbox you have to do this in the
postback handler. You can also use a java script function to validate the
length of a field client side.

Anders Norås
blog: http://dotnetjunkies.com/weblog/anoras/

Nov 18 '05 #3
Check out this link,
http://www.extremeexperts.com/Net/to...neTextBox.aspx,
--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"Neven Klofutar" <neven.klofutar*r.e..mo*****@vip.hr> wrote in message
news:eJ**************@TK2MSFTNGP10.phx.gbl...
I thought so, but why putting this property under textarea ...

Thanx, Neven
"Anders Norås" <an**********@objectware.no> wrote in message
news:er*************@TK2MSFTNGP10.phx.gbl...
Is there a way to limit this field, because "maxlength" seems to be
working
only for singleline ?

This is more of an HTML issue than a ASP.NET issue. A multiline textbox
renders as a TEXTAREA HTML element. This element has no maxlength

property.
To limit the length of a multiline textbox you have to do this in the
postback handler. You can also use a java script function to validate the length of a field client side.

Anders Norås
blog: http://dotnetjunkies.com/weblog/anoras/


Nov 18 '05 #4
Thanx

Neven

"Saravana" <sa******@sct.co.in> wrote in message
news:%N*****************@news.cpqcorp.net...
Check out this link,
http://www.extremeexperts.com/Net/to...neTextBox.aspx,
--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com
"Neven Klofutar" <neven.klofutar*r.e..mo*****@vip.hr> wrote in message
news:eJ**************@TK2MSFTNGP10.phx.gbl...
I thought so, but why putting this property under textarea ...

Thanx, Neven
"Anders Norås" <an**********@objectware.no> wrote in message
news:er*************@TK2MSFTNGP10.phx.gbl...
> Is there a way to limit this field, because "maxlength" seems to be
> working
> only for singleline ?
This is more of an HTML issue than a ASP.NET issue. A multiline textbox renders as a TEXTAREA HTML element. This element has no maxlength

property.
To limit the length of a multiline textbox you have to do this in the
postback handler. You can also use a java script function to validate the length of a field client side.

Anders Norås
blog: http://dotnetjunkies.com/weblog/anoras/



Nov 18 '05 #5
Just use a regular expression validator to limit the length of the
string value of the text area.

(from http://dotnetjunkies.com/WebLog/seic...07/28/541.aspx)

<asp:RegularExpressionValidator ControlToValidate="Content"
ValidationExpression=".{0,255}" Text="*" ErrorMessage="Please limit
the length of the content entered to 255 characters." Runat="server"/>

Hope that helps,
Joel Martinez
http://www.onetug.org - Orlando .NET User Group
http://www.codecube.net - blog

"Neven Klofutar" <neven.klofutar*r.e..mo*****@vip.hr> wrote in message news:<uh**************@TK2MSFTNGP09.phx.gbl>...
Hi,

Is there a way to limit this field, because "maxlength" seems to be working
only for singleline ?

thanx, Neven

Nov 18 '05 #6
I don't think the MaxLength attribute works with TEXTAREA elements.
You could try using JavaScript instead.

Try this:
http://forums.aspfree.com/showthread.php?t=37325
"Neven Klofutar" <neven.klofutar*r.e..mo*****@vip.hr> wrote in message news:<uh**************@TK2MSFTNGP09.phx.gbl>...
Hi,

Is there a way to limit this field, because "maxlength" seems to be working
only for singleline ?

thanx, Neven

Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Suresh Kumaran | last post by:
Hi All, Does anybody know the sytax in VB.NET to write the contents of a multiline text box to a text file? Appreciate help. Suresh
4
by: Michael C | last post by:
Hi all, I'm trying to add lines to a multiline textbox. Here's what I'd like to end up with in the textbox (as an example): Line1 Line2 Line3 I've tried a couple of methods but nothing...
7
by: Joel Finkel | last post by:
Folks, I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry. The...
2
by: Enzo Marinelli | last post by:
Hello everyone I have a MultiLine TextBox, as follows <asp:TextBo Id="StreetAddress Rows="4 Runat="Server TextMode="MultiLine Width="100%"/
1
by: ABC | last post by:
I tried KDNGrid's (www.knowdotnet.com) Multiline textbox column style for datagrid. It is very good but has some bug on wrong handle datagrid height that cannot display the scrollbar when a row...
1
by: Flack | last post by:
Hey guys, I have two questions regarding the vertical srollbar of a multiline textbox. 1. I have an "Ok" button that is initially disabled. I want it to be enabled when the user scrolls the...
2
by: Mike | last post by:
I am trying to write a little program for my own use using VB2005 express edition. I have a list of peoples names in a file that I read into an array of strings. I am using a multiline textbox to...
7
by: Anil Gupte | last post by:
I have read a lot about getting lines from a multiline textbox in VB.Net. However, I cannot for the life of me figure out how to write to a multiline textbox. Basically, I have created an array of...
2
by: Nathan Sokalski | last post by:
I have a multiline TextBox that I want to display the text used to create a control in an apsx file. I want each of these to be on a separate line in the TextBox. The only way I know of to place...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...

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.