Saturday, March 31, 2012

Text Box Control MaxLenght Property Is Not Working

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?

--
Regards,
DhanaDhana,

What browser are you using?

"Dhana" <dhana@.celtycs-consulting.com> wrote in message
news:O4c8lqgDGHA.1028@.TK2MSFTNGP11.phx.gbl...
> 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?
> --
> Regards,
> Dhana
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.

--

Andrew Robinson
www.binaryocean.com
www.bellinghamdotnet.org

"Dhana" <dhana@.celtycs-consulting.com> wrote in message
news:O4c8lqgDGHA.1028@.TK2MSFTNGP11.phx.gbl...
> 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?
> --
> Regards,
> Dhana
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.

"Andrew Robinson" <nemoby@.nospam.nospam> wrote in message
news:%23FQJ$5hDGHA.3820@.TK2MSFTNGP10.phx.gbl...
>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.
> --
> Andrew Robinson
> www.binaryocean.com
> www.bellinghamdotnet.org
>
> "Dhana" <dhana@.celtycs-consulting.com> wrote in message
> news:O4c8lqgDGHA.1028@.TK2MSFTNGP11.phx.gbl...
>>
>> 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?
>>
>> --
>> Regards,
>> Dhana
>>
>>
>>

0 comments:

Post a Comment