Maintain Viewstate, datagrid visibility, and ispostback

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jeffstl
    Recognized Expert Contributor
    • Feb 2008
    • 432

    Maintain Viewstate, datagrid visibility, and ispostback

    New to asp.net.....so far Im not sure exactly how to use the ispostback and if that is even related to what I'm trying to do.

    I have a datagrid which I have populated on page_load.
    I have a buttonlink above it which will hide and unhide the datagrid.

    The default is for the datagrid to be hidden, when the user clicks it is visible, they can click again to hide.

    I want to maintain this view when they navigate off the page and return. Do I need to store the state of the datagrid in a session variable to accomplish this? Or is there an easier way?

    Right now its (obviously) returning to the default state of being hidden when I come back to the page.
  • abev
    New Member
    • Jan 2008
    • 22

    #2
    jeffstl - you have to "store" the state somewhere - there are many different ways to do it but definitely the easiest is store it in a session variable. Session variables are very simple to work with.

    Originally posted by jeffstl
    New to asp.net.....so far Im not sure exactly how to use the ispostback and if that is even related to what I'm trying to do.

    I have a datagrid which I have populated on page_load.
    I have a buttonlink above it which will hide and unhide the datagrid.

    The default is for the datagrid to be hidden, when the user clicks it is visible, they can click again to hide.

    I want to maintain this view when they navigate off the page and return. Do I need to store the state of the datagrid in a session variable to accomplish this? Or is there an easier way?

    Right now its (obviously) returning to the default state of being hidden when I come back to the page.

    Comment

    Working...