是否可以在同一 ascx 控件中引用相同的 ascx 用户控件



是否可以在同一ascx控件中使用/引用相同的ascx用户控件?首先,我们想要一个弹出窗口中的弹出窗口 - n 个基于条件的级别。弹出窗口是用户控件。

我想这在以编程方式加载/添加控件时是可能的,例如:

this.Controls.Add(LoadControl("~/mycontrol.ascx"));

但如果你无条件地这样做,那么你就会得到一个无休止的循环。

你不能: Circular file references are not allowed.

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="WebApplication1.WebUserControl1" %>
<%@ Register TagPrefix="test" TagName="test" Src="~/WebUserControl1.ascx"%>

此代码不可行

最新更新