如何访问内容页面中Master页面的控件 [英] How to access the control of Master page in content Page
本文介绍了如何访问内容页面中Master页面的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何访问内容页面中的母版页控件
How to access the control of Master page in content Page
推荐答案
您需要@MasterPage指令..
像这样:
You need the @MasterPage Directive..
Like this:
<%@ MasterType virtualPath="~/MasterPage.master"%>
看看这个:以编程方式使用ASP.NET母版页 [ ^ ]
在您的内容页面中添加MasterPageFile =〜/ Masterpage.Master
by adding MasterPageFile="~/Masterpage.Master" in your content page
假设您要访问TextBox Maste r页面上的内容页面..可以像这样访问
Suppose you want to access the TextBox of Master page on the Content page..it can be access like this
TextBox txtBox = this.Master.Master.FindControl("txtMasterPageMaster") as TextBox;
这篇关于如何访问内容页面中Master页面的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文