DataGrid items not available on postback

M

mcollier

I'm trying to develop a page template for the ASP.NET 1.1 project I'm
working on. I want to have something like Master Pages (from ASP.NET
2.0). I'm having a problem now with databinding on a simple DataGrid.
When the page, PlanCopySelection2.aspx, loads initially it loads, and
data binds, correctly. This page has a few checkboxes in the DataGrid.
When I submit the page and handle the click event, I'm losing the line
items in the DataGrid. I think this is because the
CreateChildControls() function is being invoked, and the
ChildControlsCreated property is false. This caused the
MainContentTemplate to databind again, and I believe, all controls
under the MainContentTemplate. Thus, the DataGrid is rebound and all
the items are cleared. Hopefully I'm making some sense here.

I know one work-around is to not check the IsPostBack property on
PlanCopySelection2.aspx. That would allow all the databinding on the
DataGrid to occur again. This is unnecessary I think. I would like to
understand why this is all occuring. I think I'm just missing
something in the event flow of the page and subsequent controls. I'm
wondering if I need to do something with the databinding events
(OnDataBind() perhaps).

If you're interested in the source code, please respond and I'll be
happy to email you the code.


Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,061
Latest member
KetonaraKeto

Latest Threads

Top