Dynamically retrievng UserControl's Virtual Path

Posted by Kobojunkie on Stack Overflow See other posts from Stack Overflow or by Kobojunkie
Published on 2009-12-02T03:48:22Z Indexed on 2010/04/10 15:03 UTC
Read the original article Hit count: 207

Filed under:
|

I have an application with the FrontEnd separated into one Project file and the Codebehind/classes separated into a completely different class library. What I need is a way to, from the UserControl Type, obtain it's VirtualPath.

Typically, we would have this in code

Board uc = (Board)Page.LoadControl(@"~\Board.ascx");

But I want is something like this

Board uc = (Board)Page.LoadControl(Board.VirtualPath);

OR

Board uc = Page.LoadControl(Board);

Anyone have an idea how I can accomplish this? Thanks in advance

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about asp