Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I create a empty web application by vs2010 ,and add web usercontrol into it ,and here is code
ASP.NET
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs"
    Inherits="WebApplication1.WebUserControl1" ClassName="defined" %>
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>

and i create other web apllication abd reference webapplication1 and use web usercontrol
here is code:
XML
<%@ Register Assembly="WebApplication1" Namespace="WebApplication1" TagPrefix="e12" %>
 <e12:WebUserControl1 runat="server" ID="gsadgas" />

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
Posted
Updated 18-Oct-13 3:32am
v2
Comments
Timberbird 18-Oct-13 9:56am    
Have you checked this article? Please note the following line: "Also, the only way to share the user control between applications is to put a separate copy in each application, which takes more maintenance if you make changes to the control"
JoCodes 18-Oct-13 13:24pm    
yes you cannot share the usercontrol across applications unless u create a copy

1 solution

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[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900