Ask a Question related to ASP.NET Building Controls, Design and Development.
-
Msdn #1
Howto load a usercontrol from App_Code
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)
CurrentPlaceHolder.Controls.Add(textfield)
End Sub
Hope its usefull
Regards Keld Jakobsen
Msdn Guest
-
Howto add eventhandler to web custom usercontrol?
hi, Is there any way to add eventhandler to custom usercontrol and could set it at webForm? i can add eventhandler on code, such as at... -
When base class is used for UserControl, VS designer fails to load ASCX file
The problem is that I cannot use VS graphical designer to design my ASCX controls that do not inherit directly from System.Web.UI.UserControl but... -
dynamic userControl can't be accessed during page load
I have a userControl that I create based on how many rows I retrieve in a dataset. I add the control to my page but can't access it during the... -
Getting data from a usercontrol before containing page ends its page load
How do I load a user control in a web form first, so that the web form's page_load acts according to events on the user control? In my code... -
Use LoadControl to load a usercontrol but the webcontrol in the usercontrol can not AutoPostBack
a uscontrol test.ascx have a dropdownlist web control the dropdownlist's AutoPostBack property is set "true" but when i use...



Reply With Quote

