So here's my layout of controls, I've removed the formatting of tables and what not. The issue that I'm having is that the event InterventionSaved is always null.
<asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="rptAreaConcern_ItemDataBound">
<ItemTemplate>
<asp:UpdatePanel ID="updIntervenion" runat="server">
<ContentTemplate>
<UC:InterventionLayout ID="InterventionLayout" runat="server"/>
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
</asp:Repeater>
In the page code behind I'm trying to register the event InterventionLayout.InterventionSaved for each item in the repeater1.
protected void rptAreaConcern_ItemDataBound(Object Sender, RepeaterItemEventArgs e)
{
InterventionLayout InterventionLayout = ((InterventionLayout)e.Item.FindControl("InterventionLayout"));
//InterventionLayout.ProgressMonitor = ddlProgressMonitoringOwner; //tried to pass the drop
//InterventionLayout.ProgressMonitorDuration = ddlDuration; //down lists to the control(fail)
InterventionLayout.InterventionSaved += new EventHandler(NonAcademicInterventionSaved);
InterventionLayout.LoadAssignedInterventionData();
}
private void NonAcademicInterventionSaved(object sender, EventArgs e)
{
//this never gets called
//ParentSave();
//UpdatePanel();
}
Now in my usercontrol InterventionLayout.ascx.cs I have a save button that calls Save_Clicked(object sender, EventArgs e)
I have the even defined as:
public event EventHandler InterventionSaved;
protected void btnSave_Click(object sender, EventArgs e)
{
Save();
if(null != InterventionSaved) // this is always null
InterventionSaved(this, new EventArgs());
}
InterventionSaved is always null. I don't know why or if I am doing something wrong. I know it set in the control when I step into InterventionLayout.LoadAssignedInterventionData(). Then when I have my break point set in btnSave_Click InterventionSaved is always null.
My main goal it to be able to notify the parent and run its NonAcademicInterventionSaved() method. From there I would like to eventually cause the updatepanel to refresh. What I'm trying to do shouldn't be complicated but its turning out to be more of a headache than expected.