VS2005 UserControls

  • Thread starter Thread starter Robert Mago
  • Start date Start date
R

Robert Mago

Hi,

I have been using web usercontrols on 2003 for a very long time and i find
them userful for modularity. Usually what i do is create a subfolder called
'UserControls' for example and placed the web usercontrols there ( i would
change the namespace to *.UserControls.[control name] ).

However, when i tried this in VS2005, i couldn't get an instance of the
control when i did this.loadcontrol(control path) as X. Investigating
further i found that is no longer possible in VS2005 to get an instance of
the control that way.

So my question is, how do i achieve the same modularity in VS2005 for new
controls? Also, if i have existing solutions with the user controls already
developed and tested, is there a way to make a wrapper around them and use
them also?

Thanks,
 
You need to make an interface for the control in the AppCode folder and make
the control implement it. Then you can cast the reference from LoadControl to
the interface.
I imagine this might be why they included the extract interface refactoring
in VS2005.

Ciaran O'Donnell
 
Back
Top