Is it possible to register controls, aside from:

<%@ Register Tagprefix="CustomSearch" Namespace="SomeAssembly.WebControls" 
   Assembly="SomeAssembly.WebControls, Version=, Culture=neutral, 
   PublicKeyToken=71e9bce111e9429c" %>

within the web.config file, like you can with a normal ASP.Net web site? I tried this, but SharePoint keeps complaining that it cannot find the control?

  • Are you trying to register some user control? – V.B May 2 '12 at 8:08

If you are trying to register a variety of User Controls, you cannot do it that way. A user control requires that you reference it's .ascx file in order to use it, like this:

<%@ Register Tagprefix="CustomSearch" Tagname="SearchBox" src="~/_controltemplates/customsearch/searchbox.ascx" %>

The above allow the use of this: <CustomSearch:SearchBox ID="SearchBox1" runat="server" />

Whereas in your provided example, that registers controls, which also will allow the use of the above example, but the difference being that the controls don't have "visual" files like .ascx or .aspx.

| improve this answer | |
  • in my example these are server controls compiled in assemblies. I'm well familiar with this in ASP.net but for some reason, SharePoint does not like it? – JadedEric May 10 '12 at 13:18
  • @JadedEric Are you sure that the assembly is indeed in the GAC and that it is the correct assembly information that you type in the <%@ Register %>? – user2536 May 10 '12 at 13:30
  • i did, check on several times even recompiled and resubmitted the assemblies to the GAC. it's very weird. will play around again to see if can get around it. thanks. – JadedEric May 10 '12 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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