Hi all,
I have a very simple project in VS2005, containing one page (Default.aspx) and one user-control (SingleBox.ascx).
I want to dynamically add the uc to the page, then cast it and set its properties.
I wrapped both page and uc with the same namespace:
Page:
User-control:
My problem is that when I try to cast, the class controls_SingleBox is not recognized at the page class.
Anyone have any idea???
Thanks!!!
I have a very simple project in VS2005, containing one page (Default.aspx) and one user-control (SingleBox.ascx).
I want to dynamically add the uc to the page, then cast it and set its properties.
I wrapped both page and uc with the same namespace:
Page:
VB.NET:
Namespace MyNameSpace
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal s As Object, ByVal e As EventArgs)
If Not IsPostBack Then
Dim singleBoxCtrl = LoadControl("controls/SingleBox.ascx")
►► Dim singleBoxCtrlExplicit = CType(singleBoxCtrl, ???)
plhSingleBox.Controls.Add(singleBoxCtrl)
End If
End Sub
End Class
End Namespace
User-control:
VB.NET:
Namespace MyNameSpace
Partial Class controls_SingleBox
Inherits System.Web.UI.UserControl
Public Property MyTitle() As String
:
:
End Property
:
:
End Class
End Namespace
My problem is that when I try to cast, the class controls_SingleBox is not recognized at the page class.
Anyone have any idea???
Thanks!!!