Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Null Reference" in dynamically added UserControl

Status
Not open for further replies.

mddittman

Programmer
Sep 3, 2003
5
US
OK, here goes...

We have a page that includes a datagrid. This datagrid includes a linkcolumn that, when clicked, sets session variables that will tell the page to add the usercontrol upon reload. So the instruction to add the control to the placeholder is contained in the onItemCommand handler for the linkcolumn.

When the link is clicked, the session variables are properly populated, and the usercontrol is created. Stepping through the code, it even brings back from the database everything that is needed. However, any control on the page (Panels, LinkButtons, Literals, etc.) are not instantiated and of course we receive a "Null Reference Exception" error when we try to assign values to them.

What are we missing here??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top