Hi, using VB.NET, I am trying to load a UserControl into a PlaceHolder dynamically. In the WebForm I added the following directive:
<%@ Reference Control="../UserControls/SquareRoot.ascx"%>
In PageLoad I have this piece of code:
Dim uc As SquareRoot
Page.LoadControl("../UserControls/SquareRoot.ascx")
PlaceHolder1.Controls.Add(uc)
Here is my error message:
System.ArgumentNullException: Value cannot be null. Parameter name: child
Ultimately I want to load the control when my user click on a button but I thought I would try it in the PageLoad routine first.
Please help,
<%@ Reference Control="../UserControls/SquareRoot.ascx"%>
In PageLoad I have this piece of code:
Dim uc As SquareRoot
Page.LoadControl("../UserControls/SquareRoot.ascx")
PlaceHolder1.Controls.Add(uc)
Here is my error message:
System.ArgumentNullException: Value cannot be null. Parameter name: child
Ultimately I want to load the control when my user click on a button but I thought I would try it in the PageLoad routine first.
Please help,