开发者

Asp.net ViewState clarification

开发者 https://www.devze.com 2022-12-25 09:15 出处:网络
开发者_Python百科If I disable ViewState at Page level, will it be remembered for GridView inside the page?If you disabled ViewState at the Page level all controls on that page will have ViewState disa

开发者_Python百科If I disable ViewState at Page level, will it be remembered for GridView inside the page?


If you disabled ViewState at the Page level all controls on that page will have ViewState disabled (i.e. won't be able to use any of the functionality provided by ViewState). I'm not sure from your question if you want GridView to have ViewState enabled and all other controls be disabled, but if that's what you want to do then you have two options:

  1. If you are using .NET 4.0 then you can disabled ViewState on the page level and enable it just for the GridView
  2. If you're using .NET version prior to .NET 4.0 then you have to explicitly disable ViewState for all controls (by adding EnableViewState='false' to all elements) and don't add that for GridView. You cannot disable it on Page level and enable for GridView only.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号