Migration: ASP.NET 1.1 to ASP.NET 2.0, broken postback

We recently migrated our web application from .NET 1.1 to .NET 2.0.

The web application was originally written in .NET 1.1 using Visual Studio 2003. To port it, we converted the solutions to VS2005.

Apart from some minor issues like RESX incompatibility and broken calendar controls, the web app worked.

However, we just tested it today and some postback functions suddenly broke. In particular, the "File Browser". When the user clicks the browse button, a new window (custom page) will open that will allow him to view the file, then the PATH will be passed to the parent page and then saved in the textbox, after which it will be returned back to do some validation on the path. However, in POSTBACK, the path that was saved in the textbox has now disappeared and has been replaced with the default path.

Is there something we need to consider when moving from 1.1 to 2.0 that might break postbacks?

Thanks!:)

0


a source to share


1 answer


This is a design issue in ASP.NET 2.0.

My textbox was set to read only. This behavior was developed in ASP.NET 2.0, and it was designed with the idea that the ReadOnly TextBox should not be modified on the client side by malicious code.

Workaround: Instead of setting the readonly property at design time, you should set it at runtime.



TextBox1.Attributes.Add ("readonly", "readonly");

Literature: http://www.dotnetspider.com/resources/3120-ASP-NET--TextBox-Ready-Only-losing-client-side-changes-values-across-postback.aspx

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.readonly.aspx

0


a source







All Articles