How to use a VB usercontrol on a C# page?

Posted by ks78 on Stack Overflow See other posts from Stack Overflow or by ks78
Published on 2010-05-26T16:15:37Z Indexed on 2010/05/26 16:21 UTC
Read the original article Hit count: 277

Filed under:
|
|
|

Hopefully someone will be able to point me in the right direction.

I've created a usercontrol in VB that handles paging more efficiently than the DataPager (at least for very large datasets). I'd like to use it in a C# project, but I've been having trouble getting it to work.

I've tried simply adding PagingControl.ascx to the C# project, but when I do that the markup and VB code behind don't seem to see each other. --Is this a namespace issue?

I've tried adding the PagingControl.ascx to its own VB project, then adding that project to the C# project's solution, as well as a reference. --That almost works. I can register the PagingControl usercontrol in the markup. I can access the usercontrol's properties in the code behind, but any property that involves the UI of the usercontrol fails.

Its seems as if the usercontrol's form hasn't had a chance to load by the time the C# page's Page_Load event handler fires. --Maybe this is an "order of operations" problem? At what point in the C# page's lifetime should a usercontrol's form be loaded?

If anyone has any ideas or insight, I'd really appreciate it. Thanks in advance.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET