I am trying to use usercontrols from a different project in my asp.net 3.5 solution?
how can I use them? what is the reference?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Typically, user controls are designed to be use within a single project. This is because user control has two parts – the markup (ascx) file and code-behind. If you compile the project into a library the the code-behind class gets packaged in the dll but not the ascx part. The mark-up (ascx) contains the actual control tree and hence w/o it user control cannot be used. So one of the solution to share user controls is to compile user control’s code into a library and copy ascx files into the target project.
But the better solution is to package user control’s markup (ascx) as embedded resource of library project and then use a custom virtual path provider to load it from the resource. See this code-project article that describes this technique.