Is it possible to disable viewstate for gridview?

Hi, we need to disable viewstate for gridview, can we do that without losing main functionality(we need Paging only) , what we need to do that? any suggestions?
LVL 3
Abdu_AllahAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
masterpassConnect With a Mentor Commented:
Yes, you can do that

To disable viewstate , use this

<asp:GridView ID="GV" runat="server" EnableViewState="false" />

just use the ordinary paging code and it will work fine !!!!

paging_event
{
gridview.pageindex = e.newpageindex
//bind grid
}
0
 
Abdu_AllahAuthor Commented:
Thank you the question now is  why gridview viewstate if the grid works fine without it?!!
0
 
masterpassCommented:
I have three points

1. works improper when you engage edit mode
2. concurrency issue with ODBC
3. most important, performance will be degraded
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Abdu_AllahAuthor Commented:
>most important, performance will be degraded

Degraded! Our mean reason to remove the viewstate is to increase the performance since we place the gridview inside updatepanel.
0
 
masterpassCommented:
well, In that case I suggest you read this

http://msdn.microsoft.com/en-us/magazine/cc163901.aspx

I hope this will shed some light on ur doubts ...
0
 
Abdu_AllahAuthor Commented:
Sorry I cannot find something that support your point of view!  
0
 
masterpassCommented:
oops .... seems you are right about it .... I mis-interpreted the graph given in the site ... I will take back my point regarding performance ....
0
All Courses

From novice to tech pro — start learning today.