如何在一个用户控件中设置另一个控件属性
问题描述:
我有一个aspx页面和两个用户控件。我在一个用户控件中有一个树视图。我想要做的是,当我点击用户控件2中的按钮时,我必须在用户控件1中找到树视图并展开它。我是aspx的新手,请帮帮我..提前谢谢
Hi,
I have one aspx page and two user controls. I have a tree view in one user control. what i want to do is that when i click a button in user control 2 i must find the tree view in user control 1 and expand it. Am new to aspx, pls help me out.. thanks in advance
答
在用户控件2中...
var treeview =(TreeView)this.Page.FindControl(MyTreeViewID);
这样的东西应该有用。
In user control 2...
var treeview = (TreeView)this.Page.FindControl("MyTreeViewID");
Something like that should work.