Hello,
i have developed a web componenet library project, which
access the usercontrol that resides in another web
application. In my component, I load the control like
this:
Dim uCtrl As New UserControl
uCtrl.LoadControl("/intranet/myfile.ascx")
uCtrl.ID = "NestedGrid"
uCtrl.Visible = False
Now, when I use the component in my webform and try to
cast the usercontrol to a class, then it returns me the
error:
Specified cast is not valid.
Here is how I cast the control from my ItemCommand:
Dim ctrl As UserControl = AADataGridStores.Items
(nOpenedItem).Cells(0).FindControl("NestedGrid")
'Dim ctrl As Object = AADataGridStores.Items
(nOpenedItem).Cells(0).FindControl("NestedGrid")
Dim obj As New myfileClass
obj = CType(ctrl, myfileClass)
I am 100% sure that this is the correct class, because I
added it. I dont understand why I getting the above error.
Can anybody help me out?
Thanks