简体   繁体   English

如何将用户控件.ascx添加到同一解决方案中另一个项目中的Web窗体

[英]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.

相关问题 创建一个Web用户控件并在Web窗体上使用?,以及如何在首页上获取ddl,日历(在ascx上使用)的值 - create a web user control and used on web form?, and How to get value of ddl, calendar(used on ascx) on main page 将用户控件从一个项目复制到同一解决方案中的另一个项目 - Copy User Control from one project to another within same solution 如何在 web 表单中添加 2 个用户控件 - How to add the 2 user control in web form 如何在Web用户Control ascx中调用javascript函数 - how to call javascript function in Web user Control ascx 从另一个ascx控件刷新或添加ascx控件 - Refresh or add ascx control from another ascx control 如何在ascx控件的asp.net中添加表单和类标记 - How to add form and class tag in asp.net in ascx control 如何在解决方案中重用其他项目的Web用户控件? - How to reuse web user controls from another project in the solution? 如何将控件添加到另一个用户控件的窗体上的面板 - How to add a control to a panel on a form from another user control 如何将数据从ASCX javascript发布到相同的ascx控件? - How to post the data from ASCX javascript to the same ascx control? 我如何获取在Web项目中生成的pdf文件,并在同一解决方案c#中将其打印在另一个项目中 - How could I get a pdf file generated in a web project, and print it in another project in the same solution c#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM