Ice725 Posted April 15, 2005 Posted April 15, 2005 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? Quote
Diesel Posted April 16, 2005 Posted April 16, 2005 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. Quote
wessamzeidan Posted April 25, 2005 Posted April 25, 2005 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 Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
penfold69 Posted April 25, 2005 Posted April 25, 2005 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 Quote
wessamzeidan Posted April 25, 2005 Posted April 25, 2005 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. Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.