在母版页中查找用户控件 [英] Find a UserControl in Master page

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

问题描述



如何在母版"页面中找到用户控件?

UserControl uc =(UserControl)this.Page.Master.FindControl("Home");
对于上述用户控制,我将得到null.

Hi,

How can i find a user control in Master page?

UserControl uc= (UserControl)this.Page.Master.FindControl("Home");
I am getting getting null for above user control

推荐答案

关注该文章: ^ ]

我建议您使用母版页中的属性公开UC,然后访问它.
Follow the article: Working with ASP.NET Master Pages Programmatically[^]

I would suggest you to expose the UC using a property in master page and then access the same.




您只能放置"(UserControl)this.Page.Master.FindControl(" Home); "
Hi ,

you can put only "(UserControl)this.Page.Master.FindControl("Home");"


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

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