Saturday, March 24, 2012

Trouble Using Custom Controls

Trouble Using Custom Controls

------------------------

I've read a few articles and have put together a custom control. At the moment it simply outputs today's date for testing purposes. My asp page has two key lines.

Code:
<%@dotnet.itags.org. Register TagPrefix="CustomASP" Namespace="DBControls" Assembly="DBCalendar" %>
...
<CustomASP:DBCalendar Runat="Server" /
When I surf to the page I get:
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type DBControls.DBCalendar from assembly DBCalendar, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.

Line 26: <CustomASPB:DCalendar Runat="Server" />
Is there some variable I have to toggle in order to start using my own controls? I have it compiled and in the /bin subdirectory.Have you included the DLL for the custom control in your project?
If it makes any difference, I'm using Web Matrix, which may explain why I'm clueless what you mean when you ask if I've included that in my project.
In case someone stumbles upon this googling:

I solved my (two problems).

First, my function didn't have an arguementless constructor which apparantly is required.

Second, I used REGASM to register the DLL (Needs to have both the arguementless constructor above and admin rights on the server). Once this was done, the DLL worked properly.

This is only useful when developing with the ASP.NET Web Matrix, it's my understanding that Visual Studio.Net does this all for you.

0 comments:

Post a Comment