Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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?
Posted
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.
  • 2 weeks later...
Posted
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

Proudly a Palestinian

Microsoft ASP.NET MVP

My Blog: wessamzeidan.net

Posted
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.

Proudly a Palestinian

Microsoft ASP.NET MVP

My Blog: wessamzeidan.net

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...