Posted on: 11/12/2014 5:19:28 PM | Views : 816

ASP.Net 4.5.  IIS 7.  Visual Studio 2012.
I am adding an attribute (client-side OnChange) to TextBox controls in a FormView.  I have placed this code in the PreRender event of the FormView.  When the formview initially comes up, the PreRender code has no problem running.  However, if I make changes to fields in the formview and click the Cancel button ("Cancel" command), the PreRender code is run again and throws the following error (in debug mode in VS) when it reaches the first line (in bold below) that references a control on the formview.  Can anyone help me understand what might be going wrong?  Thank you.
System.NullReferenceException was unhandled by user code   HResult=-2147467261   Message=Object reference not set to an instance of an object.   Source=App_Web_dqfiyyjb   StackTrace:        at Extranet_Reports_Reports.EditForm_PreR ...

Go to the complete details ...