child control button click postback problem

P

pearcewg

All:

I have a page with a form and fields on the form (checkboxes, grids,
etc).
This form contains a usercontrol which has a dynamic navigational menu
of buttons.
When a user clicks on one of the buttons in the usercontrol, it is
intended to save the updates information on the parent form. This is
done using a delegate/callback function to save the data. The
callback works great, and the save method is called on the parent
page.

However, I have a problem. When the usercontrol button is clicked,
the latest data in the parent form is not there (it is the data loaded
from the database, not the changed data). All of the controls are
like this (checkboxes, textboxes, etc).

I've tried changing the order of when the callback occurs to see if
the page lifecycle has anything to do with it, but no luck. I have a
save button on the parent form, which does almost the same behavior
and works perfectly.

Is the issue that the usercontrol cannot see postback data, or that I
have to do something explicit to post it to be seen by the user
control?

Sample of the code, with usercontrol displayed (uc1:pagesidemenu):<body background=".\images\Left_Gradient.gif"
MS_POSITIONING="GridLayout">
<form id="frmBusinessNameAddr" method="post" runat="server">
<uc1:pageheader id="PageHeader1" runat="server"></uc1:pageheader>
<table cellSpacing="0" cellPadding="0" width="100%">
<tr>
<td vAlign="top" width="100">
<uc1:pagesidemenu id="PageSideMenu1" runat="server"></
uc1:pagesidemenu>
</td>
<<<

Thanks in advance for any insight,
pearcewg
 
P

pearcewg

I'm still looking, no solution yet.

I think it comes down to this question:
When a dynamically generated button in a user control is clicked, it
causes the user control to update, with updated viewstate.
How do I get the parent page to update viewstate?
Is there a way to specify the usercontrol to update parent page
viewstate, through creation or invokation or something similar?
Could raising a bubbled event fix this problem (technically, I don't
need the user control to do this work...I just want the parent page to
save it's posted data back).

Has anyone else has this problem:
UserControl contains dynamic buttons, which when clicked, lose
viewstate/data changes on parent form of usercontrol.
 
P

pearcewg

Just to followup:

I've re-learned that UserControls in asp.net have their own viewspace,
separate from the parent which contains them. As a result, a postback
of the usercontrol does not cause a postback of the parent.
I can understand this design, and will work with it, but it seems a
little strange that I am going to implement the following workaround.

I've gone ahead and removed the UserControl, and places the instance
code into each page that contains the usercontrol. It feels
good...going back all the way to 1985.

For my own long term lessons, if anyone out there knows of a solution
for this problem, please post it...

Thanks,
pearcewg
 

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,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top