Author: smohz | Posted on: 10/8/2008 10:40:36 AM | Views : 371

I?ve created a custom UserControl (ascx) in Visual Studio 2005. I?ve added a few simple controls to the ascx file (a TextBox and a ValidatorControl) and included the ascx control in an aspx page.

The ascx control has a code-behind with a Page_Load that references the underlying TextBox and ValidatorControl. However, these references are causing a NullReferenceException.

The following blog comment thread http://blogs.msdn.com/davidebb/archive/2005/10/30/487160.aspx#522889 describes my problem, and the solution is to call the ascx class, rather than the code-behind, using & ...

Go to the complete details ...