J
just_jt
I'm trying to load a control containing a grid and save the rendered
HTML to a string for later storage to a database.
The following code nearly works, but the control's Page_Load event is
not being fired. I've tried adding the control to the Placeholder,
but it has no effect. How can I get the Page_Load for the control to
fire?
Thanks - jt
--------------------- code sample --------------------
Protected WithEvents PlaceHolder1 As
System.Web.UI.WebControls.PlaceHolder
protected withevents f2 as Fiscal2
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim rc as ReportCard
rc = new ReportCard()
rc.IdA.ID="ALL"
f2 = ctype(LoadControl("~/Fiscal2.ascx"),Fiscal2)
f2.ReportCard=rc
PlaceHolder1.Controls.Add(f2)
dim sw as StringWriter = new StringWriter()
dim htw as HtmlTextWriter = new HtmlTextWriter(sw)
f2.RenderControl(htw)
htw.Close()
dim s as String = sw.ToString()
HTML to a string for later storage to a database.
The following code nearly works, but the control's Page_Load event is
not being fired. I've tried adding the control to the Placeholder,
but it has no effect. How can I get the Page_Load for the control to
fire?
Thanks - jt
--------------------- code sample --------------------
Protected WithEvents PlaceHolder1 As
System.Web.UI.WebControls.PlaceHolder
protected withevents f2 as Fiscal2
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim rc as ReportCard
rc = new ReportCard()
rc.IdA.ID="ALL"
f2 = ctype(LoadControl("~/Fiscal2.ascx"),Fiscal2)
f2.ReportCard=rc
PlaceHolder1.Controls.Add(f2)
dim sw as StringWriter = new StringWriter()
dim htw as HtmlTextWriter = new HtmlTextWriter(sw)
f2.RenderControl(htw)
htw.Close()
dim s as String = sw.ToString()