views:

43

answers:

2

Hi,

I am working on a Visual Web Part which requires creating a custom control. I am trying to add custom control to the same assembly as Visual Web Part and registering control as:

<%@ Register TagPrefix="cus" Namespace="SomeCustomControlNameSpace" %>

When I am trying to access this its throwing runtime error :

Unknown server tag 'cus:ControlName'.

Do I need to make any Web.Config entry for this?

Any Ideas?

A: 

You have to tell register which assembly to look at.

<%@ Register TagPrefix="cus" Namespace="SomeCustomControlNameSpace" Assembly="SomeCustomControlAssembly" %>
BC
Thanks. But I am not missing Assembly attribute, but I have removed it as the class file for customControl is in same assembly as the WebPart. I CANNOT specify the assembly name or compiler will start yelling at me.
FullyManaged
A: 

You are missing assembly attribute

    <%@ Register TagPrefix="cc" Namespace="MyNameSpace"
 Assembly="Controls" %>

and if you are placing you control in app_code folder than Assembly="__Code"

Pranay Rana
Thanks. But I am not missing Assembly attribute, but I have removed it as the class file for customControl is in same assembly as the WebPart. I CANNOT specify the assembly name or compiler will start yelling at me. Its not in App_Code either.
FullyManaged
than i think you require to put control in code or in another assembly will work for you
Pranay Rana
Yes it is working if I add it to another assembly. But I am trying not to do that, as there are lot of dependencies which I will have to add to that other assembly too. I don't understand why this is not working????
FullyManaged
i think its not working because its in same assembly
Pranay Rana
could you provide some reference that confirms that it will NOT work with control in same assembly. I believe it should.
FullyManaged