I am looking for a link to instructions or a walkthru for Creating Custom Controls in Asp.net 3.5.
I have already looked at the following :
http://forums.asp.net/t/1385382.aspx : Turning an .ascx User Control into a Redistributable Custom Control asp.net 3.5
http://msdn.microsoft.com/en-us/library/aa479318.aspx : Turning an .ascx User Control into a Redistributable Custom Control asp.net 2.0
I think the two above links are for Composite Custom Controls which would be fine for now, as it seems it is easier to make a Composite rather than a full Custom control.
As per the instructions in the above link ( aa479318 ) , I created a user control MyControl.ascx file and published it, which was compiled it into a self contained .dll which was named App_Web_MyControl.ascx.cdcab7d2.
Then I put a
<%Register Assembly="App_Web_MyControl.ascx.cdcab7d2"
TagPrefix="cc" namespace="TheNamespace" %>
in the aspx file (in another app) where I wanted to use the Custom Control, and I add a reference to the .dll assembly in the project.
The CustomControl name is not being recognized when I try creating it in the .aspx code by
<cc:MyControl ID="idname" runat="server" />
I get error Element 'MyControl' is not a known element.'
Best Answer
This is late, I know, but here goes..
I successfully turned an .ascx UserControl into a redistributable dll by doing this:
Published the Website project with only these settings ticked in the Publish Web Site dialog:
Use fixed name and single page assemblies
Emit debug information
Note how it is registered in web.config using namespace="ASP", and how the tag on the web page has a few underscores in it <MyPrefix:app_usercontrols_radiobuttonquestion_ascx /> This may be the key to where you're going wrong?
This worked well for me, although it took me AGES to figure out. It's probably easier to just build a server control or composite control, unless your UI is very complex.
Hope this helps somebody.