Reputation: 2570
I am working an Asp.net project, I am loading two user controls into another ascx control. First, I am loading the control1.ascx
and then the control2. After loading both of them inside control2.ascx I want to access a function that reloads some data of control1. I am doing it with the following code:
private ASP.control1_ascx tree;
tree = (ASP.control1_ascx)LoadControl("control1.ascx");
tree.aload();
When I debug the code, it seems that it calls the aload() function and updates the data. But the problem is that I cannot see them after the function is called, instead I can see the correct data after a postback event. Why is this happens?. Is there a solution to see them when I call the function ?
Upvotes: 0
Views: 122
Reputation: 4069
Have you tried creating a delegate event in each of your user controls and then use this to rebind the data?
In your usercontrol:
public delegate void RefreshRequired(object sender, any other params to pass to event method)
public event OnRefreshRequired OnRefreshRequired;
In your Page_Load of ASPX
UserControl.OnRefreshRequired+= TAB TWICE;
Implement code in this method to refresh the data in the user controls
Upvotes: 1