Karthick,
Where are you calling AddControl()? You might want to review our
documentation on how to work with dynamic controls:
http://support.microsoft.com/default...B;EN-US;317515
Jim Cheshire [MSFT]
MCP+I, MCSE, MCSD, MCDBA
Microsoft Developer Support
This post is provided "AS-IS" with no warranties and confers no rights.
--------------------
>From: (karthick raja)
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>Subject: Re: events from dynamically loaded control
>Date: 20 Jul 2004 07:59:49 -0700
>Organization: http://groups.google.com
>Lines: 42
>Message-ID: < >
>References: < >
>NNTP-Posting-Host: 162.114.211.143
>Content-Type: text/plain; charset=ISO-8859-1
>Content-Transfer-Encoding: 8bit
>X-Trace: posting.google.com 1090335590 2632 127.0.0.1 (20 Jul 2004
14:59:50 GMT)
>X-Complaints-To: groups-
>NNTP-Posting-Date: Tue, 20 Jul 2004 14:59:50 +0000 (UTC)
>Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXS01.phx.gbl!TK2MSFT NGXA05.phx.gbl!TK2MSFTNGP0
8.phx.gbl!news-out.cwix.com!newsfeed.cwix.com!news.maxwell.syr.ed u!postnews2
.google.com!not-for-mail
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:248453
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>
>I found a solution to the above problem. I added an event handler just
>after adding the control to the placeholder.
>
>
>--------
>webpage
>----------
>Protected WithEvents ctrlGeneric As Control
>Protected WithEvents phUserCtrl As
>System.Web.UI.WebControls.PlaceHolder
>....
>Private Sub AddControl()
>Me.ctrlGeneric = LoadControl("PRLargeReport.ascx")
>Dim ctrlPRLargeReport As PRLargeReportCtrl
>ctrlPRLargeReport = CType(ctrlGeneric, PRLargeReportCtrl)
>Me.phUserCtrl.Controls.Add(ctrlPRLargeReport)
>viewstate("AddedControl") = "True"
>AddHandler ctrlPRLargeReport.evShowConfirmation, AddressOf
>ctrlPRLargeReport_evShowConfirmation
>End Sub
>
>
>Private Sub ctrlPRLargeReport_evShowConfirmation()
>'handling the event here
>End Sub
>
>---------
>user control
>----------
>
>Public Delegate Sub ShowConformation()
>Public Event evShowConfirmation As ShowConformation
>...
>...
>Private Sub btnTransfer_Click(ByVal sender As System.Object, ByVal e
>As System.EventArgs) Handles btnTransfer.Click
>RaiseEvent evShowConfirmation()
>end sub
>
>
>Is there any other way to do this?? I would really appreciate your
>possible insights. thanks!
>