I want know what is view state & interface clearly,with example.
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Anand Uchagawkar48 reputationPosted Jul 7, 2010, 10:16 AM EDT
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.