c# - Invoking a method from the parent page after user control has been loaded? -


may know if there way invoke method child page(.aspx) after page load of user control finished?

right have issue of being unable retrieve value child page because variables user control has not been assigned value yet.

to put simply

from .aspx file

page_load(object sender, eventargs e) {  x = getvaluefromusercontrol(); } 

from user control

page_load(object sender, eventargs e) {  int x = getvaluefromdatabase(); }  getvaluefromusercontrol() { return x; } 

since asp.net life cycle goes child page(.aspx) page_load -> user control page_load, unable retrieve value of x.

that said, ideally not put function in child page , call user control user control being used in other pages.

in short, invoke method .aspx page after page_load in user control ends, thank you!

get value @ later page event:

protected override void onloadcomplete(eventargs e) {    x = getvaluefromusercontrol(); } 

unless, of course, there specific reason why must value on page_load. there other, more appropriate ways handle this, without knowing x , need it, hard give other advice. example, maybe usercontrol should fire event handled page.