.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> ASP.Net >> Post New Question Subscribe to Interview Questions

What are the Benifits of Using ViewState?

Posted By :Syed Shakeer Hussain     Posted Date :July 23, 2009    Points :10   Category :ASP.Net 
a).No server resources are required because state is in a structure in the page code.
b).Simplicity.
c).States are retained automatically.
d).The values in view state are hashed, compressed, and encoded, thus representing
e).A higher state of security than hidden fields.
f).View state is good for caching data in Web frame configurations because thedata is cached on the client.

You can also find related Interview Question to What are the Benifits of Using ViewState?  below: 

Benifits of viewstate?

  
1) No server resources are required because state is in a structure in
the page code.

2) States are retained automatically. (More...)

What is the difference between ViewState and SessionState?

  
ViewState persist the values of controls of particular page in the client when post back operation done. When user requests another page previous page data no longer available.

SessionState persist the data of particular user in the server. This data available till user close the browser or session time completes. (More...)

What Is The Difference Between ViewState and SessionState?

  
View State persist the values of controls of particular page in the client (browser) when post back operation done. When user requests another page previous page data no longer available.
SessionState persist the data of particular user in the server. This data available till user close the browser or session time completes. (More...)

When during the page processing cycle is ViewState available?

  
After the Init() and before the Page_Load(), or OnLoad() for a control. (More...)

Does ViewState is responsible for maintaining data across the Page Post Back for Postback controls (like textbox, dropdownlist) and non-postbackcontrols(like label)?

  
It is false. For NonPostback controls it is true but for postback controls, ASP.NET retrieves their values one by one from the HTTP request and copies them to the control values while creating the HTTP response. (More...)

When during the page processing cycle is ViewState available?

  
The view state is available after the Init() and before the Render() methods are called during Page load. (More...)

When during the page processing cycle is ViewState available?

  
After the Init() and before the Page_Load(), or OnLoad() for a control. (More...)

What is the lifespan for items stored in ViewState?

  
Item stored in ViewState exist for the life of the current page. This includes postbacks. Viewstate become nothing once it redirects or transfer to another page. (More...)

How many ViewState objects can be created on an aspx page ?

  
There is no limit. You can have any number of ViewState object on single aspx page. However more Viewstate objects, more slowly it loads. (More...)

What is the lifespan for items stored in viewstate

  
Item stored in ViewState exist for the life of the current
page. This includes postbacks (to the same page). (More...)

What are the disadvantages of viewstate/what are the benefits?

  
Disadvantages
1)Performance can be reduced. becuse the viewstate is stored in the page itself, storing large values can cause the page to slowdown.It can carry only up to 10 KB of data very easily without causing any degraded perfomance.
2) As view state is stored in a hidden field on the page although it stores data in a hashed base64 encoded format, it can be tampered.

Advantages :
1) No server resources are required
2) simple Implementation
3) Automatic retention of page & view state (More...)

How to get values across multiple pages using ViewState?

  
Ans. In page1.aspx

button_1click envent
{
ViewState["name"] = txtTest.Text;

Server.Transfer("page2.aspx");

}

In page2.aspx

In page_load
{

Page obj= this.PreviousPage;

TextBox txtNewTest = (TextBox)obj.FindControl("txtTest");

string sDisplay = txtNewTest.Text.ToString();

Response.Write(sDisplay);

}

(More...)

What is the difference between SessionState and ViewState?

  
SessionState is the data of a user session and is maintained on the server side. This data available until user closes the browser or session time-outs.



A ViewState is a state of a page within a browser wherein the values of controls persist when post back operation is done.
When another page is loaded, the previous page data is no longer available. (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend