1

I am new to SharePoint even ASP.NET.

I wrote a custom calendar control which inherits the asp:calendar and overrides some function, and it work in blank pages. But today while I am trying to use the control in a web part page, it shows unknown server tag.

In both page,

< %@ Register Assembly="SharepointTest,Version=1.0.0.0,Culture=neutral,PublicKeyToken=846d0a16c362cfbd" Namespace="SharepointTest" TagPrefix="CC" %>

and the tag

< CC:EventCalendar runat="server" >< /CC:EventCalendar >

In web.config,

< SafeControl Assembly="SharepointTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=846d0a16c362cfbd" Namespace="SharepointTest" TypeName="*" Safe="True" />

Did I did anything wrong or miss anything?

Thank you.

1 Answer 1

1

When it comes to web part pages, things work a bit differently. What I always do and I know it's not the safest, but it's the only way that works for me, is to declare the control in the controls section in your web.config:

 <controls>
        <add src="/_controltemplates/ControlName.ascx" tagName="MyTagName" tagPrefix="MyTagPrefix" />
</controls>
2
  • Thank you! It is working on the pages now. But still showing error on spd. But I think its good enough for me now.=]
    – Kris Tsui
    Commented Jan 14, 2013 at 0:22
  • Yeah, SPD is another trick to get it working.. Glad it helped
    – Fox
    Commented Jan 14, 2013 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.