什么是ViewState并给出示例? [英] What is ViewState and give an examples?

查看:67
本文介绍了什么是ViewState并给出示例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请提供您宝贵的建议和答案以及

Please give your valuable suggestions&answers and

thanks for responses.

推荐答案

请参考此链接 ^ ]



ViewState页面的隐藏字段包含启用ViewState的那些控件的状态,还使您可以保存页面上发生的回发之间的数据.
您可以在发生回发时存储数据时使用它
像这样
Hi ,
ViewState it''s hidden Fields in pages contains the states of those controls who enable ViewState ,also makes you save your data between postback that occur on the page .
You can use it when you want store the Data when postback occur
like this
Viewstate.Add( "MyViewState", "test" );


当您想检索数据时:


when you want to retrieve the Data :

if( Viewstate["MyViewState"]!=null)
{
   string MyData =  Viewstate["MyViewState"].ToString();
}


检查此链接
初学者查看状态指南 [ http://msdn.microsoft.com/en-us/library/ms972976.aspx [ ^ ]
http://msdn.microsoft.com/en-us/library/bb386448%28v = vs.100%29.aspx [ ^ ]
最好的问候
M.Mitwalli


Check this links
Beginner''s Guide To View State [^]
http://msdn.microsoft.com/en-us/library/ms972976.aspx[^]
http://msdn.microsoft.com/en-us/library/bb386448%28v=vs.100%29.aspx[^]
Best Regards
M.Mitwalli


查看状态是最重要和最有用的client side state management机制之一.

它可以在页面回发时存储页面值(从服务器发送和接收信息).

ASP.NET页提供ViewState 属性作为内置结构,用于自动存储同一页的多个请求之间的值.

View state数据已加密,无法通过FireBug
之类的软件进行查看
了解ASP.NET视图状态 [视图状态简介 [ ^ ]
View State is one of the most important and useful client side state management mechanism.

It can store the page value at the time of post back (Sending and Receiving information from Server) of your page.

ASP.NET pages provide the ViewState property as a built-in structure for automatically storing values between multiple requests for the same page.

View state data is encrypted and cannot be viewed with software like FireBug

Understanding ASP.NET View State[^]
Here you can get detailed description with how you can interpret (and protect) the data stored in View State.

Also refer:
An Introduction to View State[^]


这篇关于什么是ViewState并给出示例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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