views:

188

answers:

4

I have a multi-line textBox disabled through vb.net :

myTxtA.enabled= false

The html it outputs :

<textarea name="myTxtA" rows="10" id="myTxtA" disabled="disabled" style="width:99%;">
...
</textarea>

That's the source code I get through the browser but the textArea is still editable in the browser. There is no javascript modifying myTxtA, and the only other reference to myTxtA in my codeFile is the following :

If somethingNotHappeningHere Then
   myTxtA.ReadOnly = True
End If

I can't see why my textarea is still editable. Can the class of the div containing the textArea modify its behaviour ?

PS: I am not concerned about if the data is sent or not. I'm just looking for the textArea to be uneditable.

Edit: Same problem on IE7 and Firefox 3.5

Edit 2: When I copy all the html source from my browser into a new html file the textarea is properly disabled...

A: 
If  !IsPostBack 

Read about How psotback works in ASP.NET

Filip Ekberg
I can't see how the PostBack would affect in my case. On what should I add an If Not IsPostBack condition ?
DrDro
A: 

What browser are you using.

Check this link out http://www.w3schools.com/TAGS/att_textarea_disabled.asp

Andrew
My problem is that it's not behaving like that
DrDro
A: 

TextArea? Is this an external component? Or just an html-Textarea? Try using a TextBox, with TextMode set to MultiLine. This wil render a TextArea and you can Enable/Disable this control by setting the Enabled-property to true/false.

Pieter Nijs
In my aspx code I have <ASP:TEXTBOX [...] textmode="MultiLine"... which apparently outputs a <textarea...
DrDro
Ah, now I see! I must have read over "The html it outputs". sorry! ;-)
Pieter Nijs
No problem, thanks for the help anyway
DrDro
A: 

Hi, It has to do with your docType at the top of your aspx/html page.

lakhlaniprashant.blogspot.com