如何在asp.net的内容页面的更新面板中获取母版页控件 [英] How to get master page control in content page's update panel in asp.net

查看:73
本文介绍了如何在asp.net的内容页面的更新面板中获取母版页控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Have a label control in master page.Should get this control to content page's update panel.
The code in content page is 







ModalPopupExtender popUp = (ModalPopupExtender)Master.FindControl("ModalPopupExtender1");
            HtmlGenericControl lblMessage = (HtmlGenericControl)Master.FindControl("InfoMesg");

            lblMessage.InnerText = "Invalid page number, Please enter valid page number.";
            popUp.Show();










When update panel is place the message in lblMessage is not being displayed.
Can someone please help me achieve this.





提前谢谢。



Thanks in advance.

推荐答案

你最喜欢这样做得到内容页面更新面板外的主页面的标签控件



标签lblInfo =(标签)这个。 Page.Master.FindControl(labelID);



然后在更新面板中使用该lblInfo



ie lblinfo =XXXX;



我希望它能够工作
Better you do like this get the label control of the master page outside the content page update panel using

Label lblInfo = (Label)this.Page.Master.FindControl("labelID");

and then use that lblInfo inside the update panel

i.e lblinfo="XXXX";

I hope it ll work


这篇关于如何在asp.net的内容页面的更新面板中获取母版页控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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