Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, i have a problem with a concept ..

If i am reading a grid view from the database that shows all the products,
should i disable the view state for it ??

the teacher disable the view state , and when he binds the datagridview on page load event,
he tested if post back,,,,

C#
if(!isPostBack){
//binding the data grid view
}

and he said we must disable the view state mode to false...

why is that ???
Please help
Posted
Updated 4-May-12 2:21am
v2

If you disable the viewstate then you will have to call the binding function on every postback. if you want to call it on first load then you will have to keep the viewstate enabled.
 
Share this answer
 
Comments
csharpnew 4-May-12 9:28am    
Did the teacher made it right?
He said that logically the products table change in the database, so what we have to do it to disable the viewstate ??
Rahul Rajat Singh 4-May-12 9:36am    
yes that part is in fact right but in that case we will have to bind the gridview either in page_load irrespective of postback or every place where we are updating the table
Please go through the links below....

Link 01[^]

Link 02[^]

Regards
Sebastian
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900