Groups | Blog | Home
all groups > asp.net datagrid control > december 2007 >

asp.net datagrid control : 2.0 vs. 1.1 Read-Only Textbox/Findcontrol


John Walker
12/26/2007 11:02:00 AM
Hi,
In asp.net 1.1 I use this bit of code to get the text from a textbox in a
datagrid on postback:

txtComments = CType(dgi.FindControl("txtComments"),
System.Web.UI.WebControls.TextBox)

We recently upgraded our application to the 2.0 .net framework and this code
no longer seems to work. It is a read-only textbox... the text is
added/changed with javascipt. When we set readonly = False, then we are able
to successfully view the added/changed text on postback. Did something
change in 2.0 so that readonly text does not postback? is there a way to get
around it?

Thanks,
Toze
1/6/2008 3:10:11 PM
hi john because of security feaures in .net 2 ... asp discards changes to
readonly textbox's

the trick is to set readonly with javascript not in the server side

maybe if you set redonly to true on the pre render event it will make the
trick too



[quoted text, click to view]

Teemu Keiski
1/14/2008 9:00:21 PM
Hello:

TextBox ReadOnly in ASP.NET v2.0
http://aspadvice.com/blogs/joteke/archive/2006/04/12/16409.aspx


--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

[quoted text, click to view]

AddThis Social Bookmark Button