[英]How to add a user control .ascx to a web form which is in another project in the same solution
I have 2 projects in the solution , the first one is asp.net web service that contains .asmx file and two .ascx files (user control) , then I added empty web site with one web form . 我在解决方案中有2个项目,第一个是包含.asmx文件和两个.ascx文件(用户控件)的asp.net Web服务,然后我用一个Web表单添加了空网站。 I added a web reference of my web service to the web site , Now I want to use the user control in my new web form . 我将Web服务的Web参考添加到该网站,现在,我想在新Web表单中使用用户控件。 how can I do that . 我怎样才能做到这一点 。
when all the files are in one project it works fine , but the problem is loading the user control in a web form that is not in the same project 当所有文件都在一个项目中时,它可以正常工作,但是问题在于,将用户控件加载到不在同一项目中的Web表单中
If I understood you right, you would like to use one user control in multiple projects. 如果我理解正确,则希望在多个项目中使用一个用户控件。 You could ether add it as a reference (using add file >> existing >> browse & select >> add as link). 您可以将其添加为参考(使用添加文件>>现有>>浏览并选择>>添加为链接)。 Or if you prefer a "clean" solution, you could create a library and place the control in it. 或者,如果您更喜欢“干净”的解决方案,则可以创建一个库并将控件放入其中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.