Class in .ascx file

  • Thread starter Thread starter Jon Spivey
  • Start date Start date
J

Jon Spivey

Hi,
probably missing something obvious here. I have a user control hot10.ascx
which just contains a repeater, a code behind file hot10.ascx.vb which fills
the repeater from a datareader and a class file class1.vb. The class file
contains a function FixTitle which I need to use to format the data in the
repeater - I can access the function as Class1.FixTitle in the code behind
file but not in the user control which is where I need it.

So my question is - how do I access functions contained in a class file in a
user control? Obviously I could just copy the function to the user control
but surely thats not neccessary?

Cheers,
Jon
 
You have to expose some public interface to access the internal workings of
your usercontrol. You can either define methods and properties that wrap
your object's functionality, or you can make the controls in your
usercontrol public, which can then be accessed directly.
 
Hi,
thanks for your reply - almost ashamed to post back I just did
<@ import namespace="AppName.Class1"%>
in the user control and all worked fine. Didnt think of this at first
because there's no need to import the class into the code behind file.

Sometimes it's the simplest things.....

Cheers,
Jon
 
Back
Top