0

In my main page I created a panel with a placeholder inside and then create a modalpopup extender.

<%--UTILIZATION LEDGER PANEL--%>
<asp:Panel ID="pnlUtilLedger" runat="server" CssClass="pnlNotice" Style="width: 70%;">
    <asp:PlaceHolder ID="PlaceHolderUtilLedger" runat="server"></asp:PlaceHolder>
</asp:Panel>
<asp:HiddenField ID="hidUtilLedger" runat="server" />
<cc1:ModalPopupExtender ID="modUtilLedger" runat="server" TargetControlID="hidUtilLedger"
    BackgroundCssClass="modalPopupBackground" PopupControlID="pnlUtilLedger">
</cc1:ModalPopupExtender>
<%--UTILIZATION LEDGER PANEL--%>

and I added control to the placeholder.

 Private Sub btnUtil_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUtil.Click

    PlaceHolderUtilLedger.Controls.Add(Page.LoadControl("~/UserControls/ucUtilizationLedger.ascx"))
    modUtilLedger.Show()
End Sub

and I am trying to fire event in the usercontrol and i wont work. please help how can i fire event in the usercontrol that is not register in my main page.

down below is my button event in usercontrol that is not working.

 Private Sub btnPrintUtil_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrintUtil.Click
    'EVENT NOT WORKING WHEN CLICKED.
End Sub
Jarobe Bernardo
  • 75
  • 1
  • 10

1 Answers1

0

When adding controls you will need to expressly add the handler for the added control to the PlaceHolderUtilLedger object.

See AddHandler. https://msdn.microsoft.com/en-us/library/7taxzxka.aspx

See answer 1 on this post

Addhandler, button.click not firing using VB.NET

Community
  • 1
  • 1
Trevor_G
  • 1,331
  • 1
  • 8
  • 17