DOH! Referencing Visual Web Part in Master Page

Had a very huge brainfart today and I wanted to post the issue in case someone else runs into this due to lack of sleep and/or lack of concentration.

Was developing a visual web part and I kept getting the lovely “Object not set to the instance of an object” error. Debugging the code, the error was happening when I tried to load additional controls into the control I already declared in my “visual” part (the ascx file). WTF. It’s THERE! I see it! RIGHT THERE!

Well, if you declare the control within your master page, make sure you register it using the “src=~/controltemplates/yourusercontrol.ascx” and NOT the full Assembly/Namespace. OF COURSE, there’s no control! DOH!

Advertisement

Tags: , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.