从用户控件访问母版页上的属性 [英] Access property on master page from Usercontrol

查看:49
本文介绍了从用户控件访问母版页上的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试从用户控件访问母版页上的属性.

它是一个字符串类型的属性,我想从用户控件中设置其值.
关于如何实现此目标的任何想法...

Hi,

I am trying to access a property on master page from user control.

Its a string type property and I want to set its value from user control.
Any ideas how to achieve this...

推荐答案

我从来没有从用户控件中做到这一点,但是尝试将虚拟路径添加到母版页中. >
I have never done it from a user control, but try adding a virtual path to the master page.
<%@ MasterType VirtualPath="~/Site.master" %>



然后,我认为只需使用Master.myVariable引用变量即可.

抱歉,我在电话上,无法正常检查:(



Then, just reference the variable using Master.myVariable, I think.

Sorry, I am on my phone and can''t check properly :(


检查以下URL,


http://okcbert.info/2011/01/28/access- to-master-page-from-user-controls [ ^ ]

http://forums.asp.net/t/1380670.aspx [ http://www.codingforums.com/showthread.php?t=116840 [ ^ ]

http://p2p.wrox.com/asp-net-2-0-basics/38573-master-page-user-control-communication.html [
Check the following URL,


http://okcbert.info/2011/01/28/access-to-master-page-from-user-controls[^]

http://forums.asp.net/t/1380670.aspx[^]

http://www.codingforums.com/showthread.php?t=116840[^]

http://p2p.wrox.com/asp-net-2-0-basics/38573-master-page-user-control-communication.html[^]


这篇关于从用户控件访问母版页上的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆