Using a custom control from another project

I created a user control in a project that I want to reuse in a separate project. I saw similar attempts, successfully completed by adding a link to the source project, and then registering the control with:

<%@ Register Assembly="AssemblyName" Namespace="AssemblyName.Namespace" TagPrefix="xxx" %>

I did something similar by compiling the original project and referencing it in the following. The control has an asp: Repeater control. Then I registered my control as described above and placed the control on my page like this (the control has a string property called prop):

<xxx:ControlName ID="ControlId" runat="server" prop="21" />

However, when I run the control in a subsequent project, I get an exception with a null reference and the application suffocates. Am I doing it wrong? Do I have to have a .ascx file in the next project?

Any help is appreciated.

Thanks,

PBR

+3
source share
1 answer

As well as continued:

I did some further research and found out that the markup language (materials on the .ascx page) are not assembled. Therefore, you must have a .ascx file in the project that calls it if there is any markup associated with the control.

post-build, .ascx . , , .

, - ,

PBR

+3

Source: https://habr.com/ru/post/1720702/


All Articles