Web User Control

Ice725

Freshman
Joined
Apr 19, 2004
Messages
31
I have created a web user control called ColorChooser.ascx in VB.NET. I would like to use this same control in a C# Web application. How do I go about compiling or adding the control to the C# project?
 
Take the two or 3 files, .ascx, .cs and possibly a .resx, copy to the directory, go to project-->show all files, right-click on the file --> include in project. Just make sure when referencing that you use the right namespace.
 
you can't add it to a c# project before changing all the serverside code to c#. The ColorChooser.ascx.vb file should be changed to ColorChooser.ascx.cs and all the code in it should be changed to c# code. In your ColorChooser.ascx file, change the Codebehind and Language attributes of the @Page directive to reflect the c# changes
 
Not being an ASP user, but can't you compile it to a DLL and reference it from within the c# project as that?

P
 
No, because you need to copy the ascx file of the user control to the project, so you have to change the @Page directive to reflect the c# changes as I said earlier. User controls are different from custom controls.
 
Back
Top