Loading UserControl From Web Component Library Posted

A

anonymous

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,196
Latest member
ScottChare

Latest Threads

Top