母版页上的隐藏字段失去了它的价值 [英] Hidden Field on master page loosing it's value

查看:54
本文介绍了母版页上的隐藏字段失去了它的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我遇到了问题。我的母版页中有一个隐藏字段,当我的应用程序的第一页加载时,我正在使用代码设置。在从第一页导航到第二页的同时,我也想在第二页上隐藏字段的值。但价值来自空字符串。



我不想用会话来达到上述目的。



请帮忙!!!



谢谢..

Hi,

I am facing a problem. I have a hiddenfield in my master page which I am setting using code behind when first page of my application gets load. While navigating from first page to second page, I want that hidden field's value on my second page too. But the value comes as empty string.

I don't want to use session to achieve the above.

please help!!!

Thank you..

推荐答案

这里的主要问题是你在第一页加载中为隐藏字段设置值,当加载第二页时,隐藏字段用默认值刷新。



你也不想使用session 。



那么这里唯一的方法是传递查询字符串中的值,如果它足够短也可以这样做。



Ex: -



来自Page1:
The main problem here is you are setting value for the hidden field in first page load and when the second page is loaded the hidden field refreshed with default value.

You also dont want to use session.

Then the only way here is to pass the value in query string if it is short enough to do the same.

Ex :-

From Page1 :
Response.Redirect("~/Page2.aspx?value=test");





在Page2中加载: -



In Page2 load :-

if (Request.QueryString["value"] != null)
{
   var val = Request.QueryString["value"];
}







希望这会有所帮助。




Hope this will be of help.


这篇关于母版页上的隐藏字段失去了它的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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