如何将用户控件从Web应用程序用户控制到我当前的Web应用程序中 [英] how to user usercontrol from web application into my current web application

查看:54
本文介绍了如何将用户控件从Web应用程序用户控制到我当前的Web应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过vs2010创建一个空的Web应用程序,并将web usercontrol添加到其中,这里是代码

I create a empty web application by vs2010 ,and add web usercontrol into it ,and here is code

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs"

    Inherits="WebApplication1.WebUserControl1" ClassName="defined" %>
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>



和我创建其他网站apllication abd参考webapplication1并使用web usercontrol

这里是代码:


and i create other web apllication abd reference webapplication1 and use web usercontrol
here is code:

<%@ Register Assembly="WebApplication1" Namespace="WebApplication1" TagPrefix="e12" %>
 <e12:WebUserControl1 runat="server" ID="gsadgas" />



但是当我在broswer中查看页面时,我发现链接按钮丢失,我调试它,它说linkbutton为null,对象没有设置为实例,为什么?有人这样做,请告诉我怎么做。非常感谢,这让我很痛苦,如果你知道,请告诉我...非常感谢你


but when i view the page in broswer , i found linkbutton is missing ,and i debug it , it says linkbutton is null , object not set to instance , why ? somebody who did this, please tell me how to do it . thank you very much , it make me very pain serval days, if you know ,please please tell me...thank you very much

推荐答案

你不能分享用户项目之间的控制。相反,您可以将用户控件分离为单独的项目,然后在post build事件中,您可以在引用的项目中复制这些用户控件文件。



在此处查看分享ASP.NET用户控件 [ ^ ]
You can not share user controls between projects. Rather you can separate your user controls to separate project then in the post build event you can copy those user control files in your referenced projects.

Check here Sharing ASP.NET User Controls[^]


这篇关于如何将用户控件从Web应用程序用户控制到我当前的Web应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆