Server control with property that references to another library

P

Petr PALAS

Hi,

I'm trying to create a server control (in namespace and library
Kentico.CMS.CMSControls) for ASP.NET 1.1 that has a property of type
GeneralConnection. This type is defined in another library
("Kentico.CMS.DataEngine.dll") and namespace ("Kentico.CMS.DataEngine").

When I drag and drop the control on the Web form, I get the following error
message:
Error Creating Control
Parse Error: File or assembly name X, or one of its dependencies, was not
found.

The Kentico.CMS.DataEngine.dll libary is referenced in my project and the
page contains the TagPrefix directive for the control itself.

When I add the following additional directive to the ASPX page, everything
works fine:
<%@ Register TagPrefix="cc2" Namespace="Kentico.CMS.DataEngine"
Assembly="Kentico.CMS.DataEngine.dll" %>

However, is there any simple solution, so that the developer doesn't have to
add the additional TagPrefix directive?

Thank you.

Best Regards,

Petr Palas

****************************************************************************
****
Kentico Software
WWW: http://www.kentico.com
Blog: http://www.kentico.com/blog
Kentico CMS - The most affordable CMS for ASP.NET professionals. Sign up for
beta NOW!
****************************************************************************
****
 
S

S.Grevi

It's only my very humble opinion but...

When you write the stated tag prefix you are REFERENCING the library
Kentico.CMS.DataEngine for this page only.

Try to reference the library at project (-web project-) level...

Or I didn't get the point...

Stefano G.
 
P

Petr PALAS

Thanks for reply. I have the library referenced at the project level, but it
seems it's not enough.

Petr
 
S

S.Grevi

Let me organize the scenario :

1st Library : Kentico.CMS.DataEngine
2nd Library : Kentico.CMS.CMSControls using Kentico.CMS.DataEngine
Client : Web Form using Kentico.CMS.CMSControls

It's correct, Petr ?

Stefano G.
 
S

S.Grevi

You are welcome Petr, even if I don't have right now a 'solution' for this.

I think, however, that the reference chain is broken when you are trying to
put the control in the web form.
It's strange that the reference to the control is correctly managed but the
'2nd level' reference is not.

I'll try to search some 'inspiration' on this, in the meantime, if you are
using VS2003, could you try to put your custom control
in the toolbox and then put it on the page.

To be sure that it's all ok, see this article :
http://www.15seconds.com/issue/020430.htm

Could happen that, with this 'workaround' every reference is maintained...

Stefano G.
 
S

S.Grevi

I've found something on MSDN telling the use of the TagPrefix Attribute in
the Custom Control Creation, but in our case I think you cannot afford to
put a
'using System.Web.UI' in the assembly of the Kentico.CMS.DataEngine to
maintain the general usability of this dll even in non-web applications.

So... i'm looking for a solution, it's an interesting matter :)

This is the chunk of MSDN I've found :

To change the tag prefix
Under the CustomLabel project in Solution Explorer, double-click
AssemblyInfo to open the AssemblyInfo file in the designer. Add an Imports
statement (in Visual Basic) or using statement (in Visual C#) at the top of
the AssemblyInfo page:
' Visual Basic
Imports System.Web.UI

// C#
using System.Web.UI;
Add an Assembly: TagPrefix attribute to the list of assembly attributes.
This will specify the new TagPrefix for the CustomLabel control, in this
case xxx.
' Visual Basic
<Assembly: TagPrefix("CustomLabel", "xxx")>

//C#
[assembly: TagPrefix("CustomLabel", "xxx")]

This suggest that you put the 'using' and the TagPrefix line in the
dataEngine dll...that's crazy IMHO !

Stefano G.
 
P

Petr PALAS

Hi Stefano,

thank you for your message. Unfortunately, this is something I already tried
before and it didn't help :( Anyway, it seems to be an anomaly, since
another developer wrote me that he has a similar control and it works...

Regards,

Petr
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top