Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > TemplateControl.LoadControl from a vb class?

Thread Tools

TemplateControl.LoadControl from a vb class?

Posts: n/a
I'm making a reusable class to load and populate user controls based on
database values. I had the basic code working from codebehind, and now
I'm moving it to a reusable class.

Once in the class, Intellisense doesn't like:


So I looked up that method and saw it was a member of TemplateControl,
and tried this:


And Intellisense says it requires an object reference, so I try this:

Dim TC as TemplateControl

It gets by Intellisense, but gives the runtime error: Object reference
not set to an instance of an object on the line with TC.LoadControl, and
I can't instantiate a new instance of the TemplateControl class either.

Can someone tell me if/how I can make this work from my class so I don't
have to duplicate the code on multiple pages? Thanks!

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off