Grid state between postbacks

1 reply. Last post: April 12, 2010 10:16 PM by Glenn Layaar
Tags :
  • New Discussion
  • New Question
  • New Product Feedback

Hi,

Is there a way to make the grid keep its state between postbacks? I mean, sometimes another control (like an asp button) fires a postback for a totally unrelated matter and the grid refreshes on every postback/flypostback.

On my InitializeDataSource event I have something like this:

if (!IsPostBack || webGridBeta.IsFlyPostBack)
                e.DataSource = GetDataSet();                

 So that it'd fetch my data source the first time and on every flypostback (asuming I'm sorting, filtering, etc), but on every other postback the grid fires this event and refreshes with a blank data source. Is it possible to make it behave like a regular gridview? Where on Page_Load you'd some thing like:

grid1.DataSource = GetDataSet();
                grid1.DataBind();        

 And it'd keep its state till I rebind it?

All times are GMT -5. The time now is 9:21 PM.
Previous Next