Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

TemplateControl.LoadControl from a vb class?

 
 
MattB
Guest
Posts: n/a
 
      02-02-2006
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:

LoadControl(myUserControlPath)

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

TemplateControl.LoadControl(myUserControlPath)

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

Dim TC as TemplateControl
TC.LoadControl(myUserControlPath)

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!

Matt
 
Reply With Quote
 
 
 
Reply

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




Advertisments