Sunday, May 30, 2010

Unable to load viewstate

Most of the times when we use FormsView and GridView together in a webpage , we encounter an error,
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

Cause of the Error: It is because, when the mode of the Formview is changed to Edit, It is not made to read Only mode once the update is finished in formsView. So we have have to make sure that when ever Item is updated in FormsView, In the FormView ItemUpdated Event , FormView mode is chaned back to readonly.

Difference between Process and Thread

What is the difference between thread and a Process ?


A thread is a program in execution whereas a Process is an application which executes as a whole.

Ex: A MS-Word application can be considered as a Process whereas when you type some text in MS-Word document. you can type at the same time it checks for the spelling and grammar in the backgound. this work of checking the spelling and grammar of the word you type is done by background thread.