开发者

LoadControl(string) in different assembly?

开发者 https://www.devze.com 2023-02-20 19:02 出处:网络
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.

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 fi开发者_如何学JAVAnd 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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号