locked
ViewState RRS feed

  • Question

  • User-1499457942 posted

    Hi

      How to clear values in ViewState when form gets Unloaded using c#

    Thanks

    Wednesday, August 22, 2018 5:27 AM

Answers

  • User1120430333 posted

    Hi

      I want to know at which point ViewState values should be cleared .

    Thanks

    On a redirect or a page-unload I suspect. But I never use viewstate dragging viewstate data on the round trip between the browser and the server slowing the solution down, because viewstate data is being dragged all over the place. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 22, 2018 6:51 AM

All replies

  • User1120430333 posted

    ViewState.Clear

    ViewState.Remove(“UserAddress”)

    https://www.c-sharpcorner.com/UploadFile/2f59d0/manage-viewstate/

    Wednesday, August 22, 2018 5:51 AM
  • User-1499457942 posted

    Hi

      I want to know at which point ViewState values should be cleared .

    Thanks

    Wednesday, August 22, 2018 6:16 AM
  • User1120430333 posted

    Hi

      I want to know at which point ViewState values should be cleared .

    Thanks

    On a redirect or a page-unload I suspect. But I never use viewstate dragging viewstate data on the round trip between the browser and the server slowing the solution down, because viewstate data is being dragged all over the place. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 22, 2018 6:51 AM