User Control Unload event

E

Ethan Strauss

Hi,

I have a page which dynamically creates a bunch of instances of a single
user control and loads them into the cells of a table. Users will then be
able to alter the settings in each user control and I want to be able to
capture all of those changed settings during a single postback event on the
parent page. I set it up using a "Page_Unload" method in the user control to
send all the data to a central location, but that seems to get fired
immediately after each user control is loaded and then never again. Is there
another event in the user control life cycle which I can use to find out
when each user control is done? If not, could I raise an event from the
parent page and then make a handler in each user control to have that
control process it?

Thanks!

Ethan



Ethan Strauss Ph.D.
Bioinformatics Scientist
Promega Corporation
2800 Woods Hollow Rd.
Madison, WI 53711
608-274-4330
800-356-9526
(e-mail address removed)







Here is some code:



The parent page calls this bit once for each cell in a table:

SingleLengthQCDisplay ThisDisplay =
(SingleLengthQCDisplay)LoadControl("../QC/SingleLengthQCDisplay.ascx");

if (QCResults.ContainsKey(ThisTube.LocationInBox))

{

ThisCell.Controls.Add(ThisDisplay); //Note that the User control Page_Unload
method gets called here!

}





This is the code on User control:

protected void Page_Unload(object sender, EventArgs e)

{

if (plasmidName == null)

{

//Do Stuff Here

}



}
 

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

Top