GridView Question

  • Thread starter Thread starter Gonza
  • Start date Start date
G

Gonza

Hi group, i have a question relatred to gridview and postback (i should
probably know this by now, considering i've been working with .net for
a few years now, but baahh). Why could a gridview (regular gridview, no
custom controls inside, bound to a list<custom object>) loose it's
value after a postback. I know that the datasource is not saved in
viewstate, but why are the rows getting cleared????

Thanks in advace

Gonzalo, from Argentina
 
Hi group, i have a question relatred to gridview and postback (i should
probably know this by now, considering i've been working with .net for
a few years now, but baahh). Why could a gridview (regular gridview, no
custom controls inside, bound to a list<custom object>) loose it's
value after a postback. I know that the datasource is not saved in
viewstate, but why are the rows getting cleared????

I imagine because you're populating the GridView in Page_Load, and the code
which fetches the data is surrounded by an IsPostback test...
 
Yes, i'm doing exactly that, but the question remains: Why should i
rebind the gridview on every postback?

Mark Rae ha escrito:
 
Yes, i'm doing exactly that, but the question remains: Why should i
rebind the gridview on every postback?

Several possibilities:

1) You have turned EnableViewState off on the GridView, or even on the
entire page.

2) The GridView is being created dynamically.

3) The GridView's datasource does not persist across the postback.
 
Back
Top