如何在一个用户控件中设置另一个控件属性 [英] how to set a control property in one user control from another
本文介绍了如何在一个用户控件中设置另一个控件属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个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.
这篇关于如何在一个用户控件中设置另一个控件属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文