日期:2014-05-17 浏览次数:20586 次
//UserControl <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="WebApplication1.WebUserControl1" %> <asp:TreeView id="SampleTreeView" runat="server" > <Nodes> <asp:TreeNode Value="1" Text="1" Target="Content" Expanded="True"> <asp:TreeNode Value="2" Text="2" Target="Content"> <asp:TreeNode Value="2a" Text="2a" Target="Content"/> </asp:TreeNode> <asp:TreeNode Value="3" Text="3" Target="Content"> </asp:TreeNode> </asp:TreeNode> </Nodes> </asp:TreeView>
------解决方案--------------------
自定义控件中还是公布一个属性吧
public TreeNode SelNode
{
get{return TreeView.SelectedNode;}
}
访问时
uc1.SelNode