471,318 Members | 1,989 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,318 software developers and data experts.

Loading UserControl From Web Component Library Posted

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

Jul 21 '05 #1
0 1065

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by steve bull | last post: by
4 posts views Thread by John | last post: by
1 post views Thread by Sundaresan | last post: by
4 posts views Thread by Harry | last post: by
reply views Thread by Gary Shell | last post: by
12 posts views Thread by Joe | last post: by
4 posts views Thread by Adam Biser | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.