如何找到&呼叫主页控制&子页面中的方法 [英] How to find & call master page control & methods in child page
本文介绍了如何找到&呼叫主页控制&子页面中的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好......
我们如何访问子页面中的母版页控件和方法
Hello...
How we access master page controls and methods in child page
推荐答案
Label myLabel = (Label)Master.FindControl("myLabelFromMasterPage"); // access the control from master page
// mater page
public MyMasterPage: MasterPage
{
public int Add(int a, int b)
{
return a + b;
}
}
// content page
(this.Master as MyMasterPage).Add(5, 5);
-KR
-KR
这篇关于如何找到&呼叫主页控制&子页面中的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文