i want know what is view state & interface clearly,with example.
i want know what is view state & interface clearly,with example
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anand UchagawkarPosted Jul 7, 2010, 2:16 PM
Viewstate::
Since our web pages are stateless so for persisting the state of the page when it is posted back to the server ASP.NET uses the concept of Viewstate. Each & every control including the Page has a property EnableViewstate which is by default set to true. When the EnableViewstate property is set to true then the ASP.NET along with the HTML response also sends the state of the control.
Of your generated asp.net page in web browser if you access a hidden control "_Viewstate" then you will see some serialized value of the controls of the page. When the page is posted back to the server in the asp.net life cycle it loads the controls values withe Viewstate data from this hidden control before the Page Load event occurs. That is why we can access the controls data as if it was previously filled.
Interface::
Interface is a kind of class which contains only the definition of memeber varaibles and methods but not declaration. The main purpose of the Interface is to support Multiple Inheritance. When we need some method implementation should happen in a particular class we can enforce them by using Interface.