如何获得母版页控制 [英] how to get masterpage control
本文介绍了如何获得母版页控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨专家。
我的母版页面上有一个标签lbluser,我需要在我的子页面中访问该标签
i在我的子页面中使用 lblUserName =(Label)Page.Master.FindControl(lbluser);
但是它重新调整为null价值......任何想法。
Hi Experts.
I have a label lbluser in my master page and i need to access that label in my child pages
i am using lblUserName = (Label)Page.Master.FindControl("lbluser");
in my child page..but it is retuning null value..any idea.????
推荐答案
您应该尝试:
在母版页中:
You should try like:
In master page:
<asp:label id="lbluser" runat="server" text="Sample master Page label Control"/>
从子页面:
From child page:
Label lblUserName = (Label)Master.FindControl("lbluser");
希望对您有帮助。
Hope that helps you.
TRY这个.. :)
TRY THIS.. :)
lblUserName = (Label)Master.FindControl("lbluser");
了解更多信息..: )
内容页面和母版页之间的交互 [ ^ ]
使用ASP.NE T Master Pages以编程方式 [ ^ ]
这篇关于如何获得母版页控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文