J
jwwishart
The following class implements an interface which is in an assembly in
the GAC
The assembly that this class is in is loaded dynamically upon session
start into the Current AppDomain. It is stored in a folder within the
web application. (Not in the bin directory!)
My Problems are these...
1. I can load the User control dynamically but it always adds it to
the end of the render HTML (After the ending </html> tag. (Which is
not good )
2. The label is also add after the </html> closing tag
3. The last button doesn't even get added
I'm putting some of the controls as you see into a placehold.
Why are these things so... Does anyone have any idea's ??
Regards,
Justin
------
Public Class Plugin
Inherits MarshalByRefObject
Implements IPlugin
Public Function ProcessPage(ByVal page As System.Web.UI.Page) As
Boolean
Implements JuratPluginLibraryTEST.IPlugin.ProcessPage
' Get all the rows in the Text table of the database
Dim data As DataTable = ExecuteSQLWithDataset("SELECT *
FROM Strings").Tables(0)
' Add the Security Control
Dim securityControl As Object
securityControl = page.LoadControl("~/Plugins/MyPlugin/
Security.ascx")
securityControl.ID = "Security1"
' Create the new control
Dim lab As New Label()
Dim str As New StringBuilder()
For Each row As DataRow In data.Rows
str.Append(row.Item(0).ToString()).Append("<br />")
Next
lab.Text = str.ToString()
lab.Font.Name = "Verdana"
lab.ForeColor = System.Drawing.Color.Green
lab.Font.Size = FontUnit.Medium
' Add Controls
page.FindControl("placehold").Controls.Add(securityControl)
page.FindControl("placehold").Controls.Add(lab)
' Modify a UserControl - Change text via a property
Dim securityUserControl As Object
securityUserControl = page.FindControl("Security1")
securityUserControl.TextValue = "Ay Carumba"
' Add a button
Dim btn As New Button()
btn.Text = "Pressing me does nothing"
page.Controls.Add(btn)
End Function
End Class
the GAC
The assembly that this class is in is loaded dynamically upon session
start into the Current AppDomain. It is stored in a folder within the
web application. (Not in the bin directory!)
My Problems are these...
1. I can load the User control dynamically but it always adds it to
the end of the render HTML (After the ending </html> tag. (Which is
not good )
2. The label is also add after the </html> closing tag
3. The last button doesn't even get added
I'm putting some of the controls as you see into a placehold.
Why are these things so... Does anyone have any idea's ??
Regards,
Justin
------
Public Class Plugin
Inherits MarshalByRefObject
Implements IPlugin
Public Function ProcessPage(ByVal page As System.Web.UI.Page) As
Boolean
Implements JuratPluginLibraryTEST.IPlugin.ProcessPage
' Get all the rows in the Text table of the database
Dim data As DataTable = ExecuteSQLWithDataset("SELECT *
FROM Strings").Tables(0)
' Add the Security Control
Dim securityControl As Object
securityControl = page.LoadControl("~/Plugins/MyPlugin/
Security.ascx")
securityControl.ID = "Security1"
' Create the new control
Dim lab As New Label()
Dim str As New StringBuilder()
For Each row As DataRow In data.Rows
str.Append(row.Item(0).ToString()).Append("<br />")
Next
lab.Text = str.ToString()
lab.Font.Name = "Verdana"
lab.ForeColor = System.Drawing.Color.Green
lab.Font.Size = FontUnit.Medium
' Add Controls
page.FindControl("placehold").Controls.Add(securityControl)
page.FindControl("placehold").Controls.Add(lab)
' Modify a UserControl - Change text via a property
Dim securityUserControl As Object
securityUserControl = page.FindControl("Security1")
securityUserControl.TextValue = "Ay Carumba"
' Add a button
Dim btn As New Button()
btn.Text = "Pressing me does nothing"
page.Controls.Add(btn)
End Function
End Class