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

Binding to a bound grid by Elton

Elton
Wed Feb 16 15:41:34 CST 2005

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
elton_wang@hotmail.com

>-----Original Message-----
>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
>
>
>.
>

Re: Binding to a bound grid by Elton

Elton
Thu Feb 17 07:36:44 CST 2005

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

>-----Original Message-----
>On Wed, 16 Feb 2005 13:41:34 -0800, Elton Wang wrote:
>
>> 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
>> elton_wang@hotmail.com
>>
>>>-----Original Message-----
>>>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
>>>
>>>
>>>.
>>>
>Even when ViewState is enabled (not that I recommend that
viewstat is
>enabled for grids).
>
>.
>