Text Box Control MaxLenght Property Is Not Working

D

Dhana

Hi All,

I have developed one web application.
In that I used aspnet web textBox control.
I have set maxlength property for that text box 300 and TextMode property as
multiline .

When i typed more than 3 or 4 line each line contains 30 to 40 characters,
If i clicked button for passing textbox value, that time my web page is not
responsding (no action taken).

The same page without refereshing if i delete some characters from my
textbox.
It is working.

Can someone help me for this?
 
A

Andrew Robinson

A TextBox in MultiLine mode is rendered as a TextArea HTML control. TextArea
as opposed to an Imput control does not have a maxlength property. It will
be ignored in the TextBox.

There are some 3rd party controls and projects out there that attempt to
control length with javascript for a multiline textbox. I haven't used any
of them so can't comment.
 
S

Sosh

Ah yeah...

Try using a javscript function like:

function limitTextarea(textarea, maxlength) {
if (textarea.value.length > maxlength)
textarea.value = textarea.value.substring(0, maxlength);
}

and set the onchange attribute (either programatically with
textbox.attribute.add() or declaratively) on the textbox to call the
function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top