By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,079 Members | 916 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,079 IT Pros & Developers. It's quick & easy.

DataGrid items not available on postback

P: n/a
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.

Feb 13 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.