是否可以获取当前页面中先前页面视图状态的值? [英] Is it possible to get the value of previous page view state value in current page?
本文介绍了是否可以获取当前页面中先前页面视图状态的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
您能告诉我是否有可能在当前页面中获取上一个页面视图状态值吗?
例如,第1页:
Hi All,
Can you tell me if it is possible to get the value of previous page view state value in current page?
For example, page1:
viewstate["Name"]="Akash"
response.redirect("page2.aspx")
所以在Page2中,如何获取viewstate["Name"]
的值?
有可能吗?如果是这样,怎么办?
感谢和问候
Lijo
So in Page2, how can I get the value of viewstate["Name"]
?
Is it possible? If so, how?
Thanks and Regards
Lijo
推荐答案
您可能会先阅读一本基础书籍,因此您有了一些有关您正在做什么的线索.
您有两个选择:
1-您可以进行跨页回发,其中第1页设置了第2页以查看其视图状态.这是一个丑陋的hack
2-您可以将两个页面带入页面,将它们变成控件,在同一页面上显示它们,然后它们将共享viewstate b/c,它们是同一页面.
You might start by reading a basic book, so you have some sort of clue about what you''re doing.
You have two options:
1 - you can do a cross page postback, where page 1 sets up page 2 to see it''s viewstate. This is an ugly hack
2 - you can take your two pages, turn them into controls, show them on the same page, and then they will share viewstate b/c they are the same page.
您不需要使用viewstate.您只需要将名称值传递给page2
You don''t need to use viewstate. You just need to pass the name value to the page2
server.transfer("page2.aspx?Name=Akash")
是的,您可以按照Mark的想法解决问题,但是如果您希望安全,则可以对页面中的查询字符串进行加密/解密.
yeah, you can solve the issue by Mark''s idea, but if you want secure then encrypt/decrypt the querystring in pages.
这篇关于是否可以获取当前页面中先前页面视图状态的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文