是否可以在同一个 ascx 控件中使用/引用同一个 ascx 用户控件?首先,我们希望在弹出窗口中的弹出窗口中弹出一个弹出窗口 - 基于条件的 n 级。弹出窗口是用户控件。
问问题
144 次
2 回答
1
我想这在以编程方式加载/添加控件时是可能的,例如:
this.Controls.Add(LoadControl("~/mycontrol.ascx"));
但是如果你无条件地这样做,那么你会得到一个无限循环。
于 2012-10-09T09:36:35.813 回答
0
你不能 : 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"%>
此代码是不可能的
于 2012-10-09T09:42:40.410 回答