Binding to a bound grid

  • Thread starter Thread starter MattC
  • Start date Start date
M

MattC

Hi,

This question is in relation to a System.Web.UI.DataGrid

If I bind some data to a grid, then in a subsequent postback bind to it
again, does the grid intrincially clear its contents before adding the new
information.

TIA
 
Hi Matt,

When postback, the datagrid losses its underlying data
source already. If you want to show the datagrid again,
you have to rebind its data source.

HTH,

Elton Wang
(e-mail address removed)
 
Hi Matt,

When postback, the datagrid losses its underlying data
source already. If you want to show the datagrid again,
you have to rebind its data source.

HTH,

Elton Wang
(e-mail address removed)
Even when ViewState is enabled (not that I recommend that viewstat is
enabled for grids).
 
You are right. I forgot the simplest thing. When ViewState
is enabled, after postback, if the datagrid keeps all
things unchanged, it can be shown without rebinding data
source. But if something changes, not even its data, it
can't be shown without rebinding data source.

We all know the datagrid is much more complicated than
many other web server controls. It has many
functionalities, such as paging, sorting, in-line editing,
and so on. In term of ViewState of the datagrid, I
personally think it's better to enable it. Although it
has better performance with disabled ViewState, it might
also disable some functionalities.

Elton Wang
 
Back
Top