For the last year i've been looking for a way to load my usercontrols at runtime from different pages using a standard.

I know i can reference my control in my page, but i wanted to make a class that dynamicly loaded the control and added i to my page.

Today it finally worked.

Public Sub LoadTextField(ByVal CurrentPage As Page, ByVal CurrentPlaceHolder As PlaceHolder, ByVal CurrentWidth As Integer)
Dim textfield As UserControl = CurrentPage.LoadControl("~/textfield/textfield.ascx")
Dim BoxWidthProperty As System.Reflection.PropertyInfo = textfield.GetType.GetProperty("BoxWidth")
BoxWidthProperty.SetValue(textfield, CurrentWidth, Nothing)
End Sub

Hope its usefull

Regards Keld Jakobsen