在另一页中显示标签的值 [英] displaying value of label in another page

查看:99
本文介绍了在另一页中显示标签的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我正在c#asp.net上工作,我想在页面加载时在另一页中显示标签的值...任何人都可以帮助.....

hey guys

m working on c# asp.net i want to display value of label in another page at pageload...can anyone help.....

推荐答案

提供公共属性,用于访问标签并返回/设置内容:
Provide a public property which accesses the label, and returns / sets the content:
public string MyProperty
   {
   get { return myLable.Text; }
   set { myLable.Text = value; }
   }

然后可以使用页面实例对其进行访问.

刚意识到这可能是ASP.NET:将标签内容保存到cookie或Session状态变量,然后以这种方式访问​​它.您无法直接访问其他浏览器页面的内容.

You can then use the page instance to access it.

Just realized this is probably ASP.NET: save the label content to a cookie, or Session state variable and access it that way. You can''t access other browser page contents directly.


在页面加载时在另一页面中显示标签的值
好吧,这取决于您的导航方式.

此外,这也将取决于文本的长度.如果文本很短并且可以允许用户在URL中看到,则可以使用QueryStrings.否则,您可以使用会话"在第1页上存储标签值,然后在其他页面上访问该标签值.
还有更多基于导航的方法,例如使用PreviousPage概念.如果您遵循该路线,则可以在页面上发布属性并使用PreviousPage进行访问.
display value of label in another page at pageload
Well, it would depend on how you are navigating.

Further, it would also depend on the length of the text. If the text is short and can be allowed to be seen by user in URL then you can use the QueryStrings. Or else, you can use Sessions to store the label value on page1 and then access the same on other page.
There are more ways based on navigation like using PreviousPage concept. If you follow that route you can expost a property on the page and access it using PreviousPage.


以上两个答案应该可以使您顺利进行.进一步,您可以参考
1. http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx [^ ]
2. http://steveorr.net/faq/passvalues.aspx [
Above two answers should get you going..Further you can refer
1. http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx[^]
2. http://steveorr.net/faq/passvalues.aspx[^]

Hope this helps.
All the best.


这篇关于在另一页中显示标签的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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