ReadOnly Property of TextBox

Author Topic
Darshita Patel
Member

Joined: 27 May 2004
Country: USA
Posts: 2

Posted: 02 Jun 2005 14:56:24

Hello guys,

I am using Visual Studio 2005 Beta 2 environment. In Beta2, there is a known bug that if you have TextBox set to ReadOnly property to true then in postback it looses its value meaning "" is being returned when postback happens.

web application that I am trying to convert to .NET beta 2 has many TextBox that uses ReadOnly property and my application is now failing. Can someone provide me with good solution so I don't have to do whole lot of coding and also when Visual Studio 2005 is released I will have just less code to delete as well.

I will really appreciate your help.
Thanks,
Dp

Hello guys,

I am using Visual Studio 2005 Beta 2 environment. In Beta2, there is a known bug that if you have TextBox set to ReadOnly property to true then in postback it looses its value meaning "" is being returned when postback happens.

web application that I am trying to convert to .NET beta 2 has many TextBox that uses ReadOnly property and my application is now failing. Can someone provide me with good solution so I don't have to do whole lot of coding and also when Visual Studio 2005 is released I will have just less code to delete as well.

I will really appreciate your help.
Thanks,
Dp
babuji godem
Member

Joined: 20 Nov 2007
Country:
Posts: 1

Posted: 20 Nov 2007 14:13:29

You May Use

<asp:TextBox ID="TextBox1" runat="server" onfocus="this.blur()" style="cursor:hand" />
<asp:TextBox ID="TextBox1" runat="server" contenteditable="false" />
or
in the code file

TextBox1.Attributes.Add("Readonly","ReadOnly"

You May Use

<asp:TextBox ID="TextBox1" runat="server" onfocus="this.blur()" style="cursor:hand" />
<asp:TextBox ID="TextBox1" runat="server" contenteditable="false" />
or
in the code file

TextBox1.Attributes.Add("Readonly","ReadOnly"
Jeff Gibson
Member

Joined: 20 Nov 2007
Country:
Posts: 2

Posted: 20 Nov 2007 19:57:02

What is the reason for using the ReadOnly property? Is it Just to stop the user from interacting with the control or what? I am only asking because you might be able to get away from using ReadOnly and perhaps look into the Enabled property if you just want the user not to be able to alter the text.

Thanks for the heads up on the "known bug" - this is the first time I am hearing of it.

What is the reason for using the ReadOnly property? Is it Just to stop the user from interacting with the control or what? I am only asking because you might be able to get away from using ReadOnly and perhaps look into the Enabled property if you just want the user not to be able to alter the text.

Thanks for the heads up on the "known bug" - this is the first time I am hearing of it.
Follow us on twitter Subscribe to our RSS feed
Activate your free membership today | Login | Currency