1

I'm developing a stand-alone ASP .NET component for dropping in to various sites we create. Part of the application is a CompositeControl, which needs to load a UserControl.

However, CompositeControl has no LoadControl() method - in stead, I must (as far as I can see?) rely on Page.LoadControl() and this is a problem!

How do I know the path to my control, when the page is not part of the assembly? The page the CompositeControl is situated on resides outside the assembly I am writing the Page.LoadControl() code in, and thus cannot find my .ascx file.

I've tried LoadControl(type, object[]) but this doesn't load the "code infront" file, which I need.

So - how do I find the Path to some .ascx file inside some included assembly (name known, ofc) for my Page.LoadControl? Or, alternatively, is there some other way to load the control from inside the CompositeControl?

Cheers!

EDIT:

The following provided the solution, although it is slightly hacky. It does work, however: http://www.cmswire.com/cms/tips-tricks/aspnet-reusing-web-user-controls-and-forms-000915.php

Fafnr
  • 247
  • 1
  • 3
  • 18

1 Answers1

0

This may be of some help to you : http://blogs.msdn.com/b/davidebb/archive/2005/10/30/487160.aspx

Richard Friend
  • 15,800
  • 1
  • 42
  • 60
  • I've just read it, and unfortunately it doesn't seem to fix my problem. While I guess I COULD use absolute URLs, it's ugly and far too prone to break when stuff is moved between servers - as it is apt to be - and machine-wide resources seem like way overkill. Thanks for the link, though! – Fafnr Mar 31 '11 at 10:59
  • The article did with some modifications help, as I had the same issue. – Sarah Weinberger Sep 14 '13 at 01:32