日期:2014-05-18  浏览次数:20427 次

如何访问ASCX ?
两个ASCX A.ascx和B.ascx a.ascx有一个方法 P ,在B.ascx如何去调用A.ascx的方法P?
谢谢!!

------解决方案--------------------
反射吧.
在引用页面调用用户控件的方法,在用户控件调用引用页面的方法,就用户控件调用了另一个用户控件的方法了.
以下为DEMO代码
WC1.ascx
HTML code
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WC1.ascx.cs" Inherits="WC1" %>
the label1(red):<asp:Label ID="Label1" runat="server" ForeColor="Red"></asp:Label>