Gridview ControlState is very large, even if view mode is disabled and does not use DataKeyNames

I have asp: Gridview bound to asp: ObjectDataSource. I disabled ViewState in the GridView and did not set the DataKeyNames property. I have about 10 BoundFields and a few TemplateFields. These TemplateFields are not bound to server controls, but to a binding tag or to an img tag.

However, at runtime, when I turn on page tracing, I see that the ControlState in the Gridview ranges from 7 to 12K to display only 14 rows of data. (Viewing the source on the displayed page also gives the same long line in the hidden __VIEWSTATE field). I don’t understand why this is happening, since I have enableViewState = "false" in gridview and, as mentioned above, I do not use DataKeyNames. So where does this Gridview ControlState come from, and is there a way to get rid of it?

Thanks in advance Tim

+3
source share
3 answers

, : , (, ), , , .

note: ASP.NET , . , Microsoft

, ControlState _ViewState, , microsoft ControlState , viewstate, ViewState

+4

viewstate, - gridview, /, , , . . , .

.net 3.5, ListView, /.

0

, __VIEWSTATE HybridDictionary.

, , EnableViewState=false, ControlState ( - ):

0
source

Source: https://habr.com/ru/post/1726167/


All Articles