0

I'm trying to learn how create a web user control so i can use in diffrent projects. I created a simple control just to see how it worked; after I created it, I could add it to any page on the current project and it worked fine.

My problem is how can I add this control to the tool box so I can use it in diffrent projects? I tried to look for him by doing:

right click toolbox > choose items > looking for it.
I can't see the control in the list. 

What do i need to add so i can see it?

Here is the same question but nothing help me :( I'm using visual studio 2010.

Community
  • 1
  • 1
samy
  • 1,949
  • 6
  • 39
  • 64
  • 1
    You have to look for the actual DLL, did you do that, is your Project a Web Application Project or Website Project? If you are going to want a library of your own controls then I would recommend creating a separate project and create the controls in that project and then reference them from there. – Lloyd Feb 27 '12 at 14:17
  • @Lloyd how do i add a library (dll) to a website project? – samy Feb 27 '12 at 14:25
  • When you build an ASP.Net Web Application it deployes the dll in the "bin" directory in either the "Debug" or "Release" directories. The "bin" directory is hidden by default, you must click on "Show All Files" on the projects main tab to see the folder. You are better off doing as @Sanjay Goswami has said and creating a Custom Control in a new project. – Lloyd Feb 27 '12 at 14:30
  • ok i will go with Sanjay solution thx any way :) – samy Feb 27 '12 at 14:31

1 Answers1

3

Hey you have to create CustomControl instead of User Control

http://support.microsoft.com/kb/893667

Brian Mains
  • 50,520
  • 35
  • 148
  • 257
Sanjay Goswami
  • 1,386
  • 6
  • 13
  • how do i add html tags to the custome control? that guide dosnt expline every thing.. i did every thing in that guide 2 times and it still fail :( when i try to add a the control to an aspx like the guide say it say the the cc are not recognize.. – samy Feb 27 '12 at 15:18
  • Hey Its sould work... (its msdn help) pls check your code may be some thing missing like <%@ Register TagPrefix="CC " Namespace=" CustomServerControlsLib " Assembly="CustomServerControlsLib " %> – Sanjay Goswami Feb 27 '12 at 15:22
  • do i need to replace <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> with the <%@ Register TagPrefix="CC " Namespace=" CustomServerControlsLib " Assembly="CustomServerControlsLib " %> or have both of them on the page? – samy Feb 27 '12 at 15:50
  • its working. I got some qustions 1.do i need to refrence this to any web form im using? 2.is it possible to use this "control" from the toolbox (becuse im not seeing him there)? – samy Feb 27 '12 at 20:36