母版页标签值会在导航到下一页后更改吗? [英] Master page Label value will be changed after navigation to next page?

查看:71
本文介绍了母版页标签值会在导航到下一页后更改吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..

我毫不怀疑..

如果我在母版页眉中具有标签控件,则在导航到下一页后,其他页面将更改标签值/文本.如何执行此操作,请帮帮我.

我尝试过
在aspx页面中:

Hi..

I have small doubt..

If i have label control in master page header.that label value/text will be changed after navigation to next page ,other pages.How to do this please help me.

i tried like
in aspx page:

page load();
 Label lbl = (Label)Page.master.findcontrol("lbl");
lbl.text ="fggf";



还有其他方法可以更改标签文本..请帮助我

在此先感谢



Is there is any other way to change label text..please help me

Thanks in advance

推荐答案

使用公共属性是其中之一.
Use the public properties is one of theway.


您必须在此处查看事件触发机制,放置母版页后,可以将标签控件公开为属性,如下所示:
You have to see the event firing mechanism here, when master pages in place, you can expose the label control as a property as shown below:
public Label NameLabel
{
  get { return lbl; }
  set { lbl = value; }
}


在代码中访问NameLabel,还请牢记母版页的应用程序生命周期,您的问题在此处得到解决


Access NameLabel in the code, also keep in mind application life cycle with master pages, your issue get solved here


这篇关于母版页标签值会在导航到下一页后更改吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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