2

I have written a replacement SmallSearchInputBox packaged as a feature and this has been working fine on the test server. VS2010 is also installed on the test server and I have been able to deploy directly from VS2010.

I now want to set up the production server. I took the WSP from the VS release folder and installed it on the prod server using Power Shell - Add, Install etc. I activated the feature but no search box is visible - no even the standard search box. I have set the logs & traces to verbose but there is not mention of search at all.

I pulled up the master page in the Sharepoint designer and was surprised to see my replacement search box displayed in the preview!

What might be going on here? My feature seems to be active but somehow is not being displayed. Has the search been deactivated for some reason? How could I check?

3 Answers 3

7

Could you post your feature element manifest? Remember the lowest sequence "wins" for your delegate control, so maybe you already have another delegate that has a lower sequence on production?

Check out this guide on how to replace search control: https://msmvps.com/blogs/sundar_narasiman/archive/2011/02/19/sharepoint-2010-delegate-control-to-replace-smallsearchinputbox.aspx

UPDATE: How to detect what delegate control is currently running from a console app (curtesy of one of my colleagues):

private static void Main(string[] args)
{
    using (SPSite site = new SPSite("http://yoursite/"))
    {
        using (SPWeb web = site.OpenWeb())
        {
            bool contextCreated = false;
            if (HttpContext.Current == null)
            {
                 contextCreated = true;
                HttpRequest request = new HttpRequest(string.Empty, web.Url, string.Empty);
                HttpContext.Current = new HttpContext(request, new HttpResponse(new StringWriter()));
                HttpContext.Current.Items["HttpHandlerSPWeb"] = web;
            } 
            DelegateControl dc = new DelegateControl {AllowMultipleControls = true, ControlId = "SmallSearchInputBox"}; 
            MethodInfo method = dc.GetType().GetMethod("CreateChildControls", BindingFlags.NonPublic | BindingFlags.Instance);
            method.Invoke(dc, null); 
            foreach (Control control in dc.Controls)
            {
                System.Console.WriteLine(control.ToString());
            }
            if (contextCreated) HttpContext.Current = null;
        }
    }
}
3
  • Yes, I had wondered that but if it is the case then the 'winner' is not showing himself! Not even the standard search box is visible. Thanks for the link - I'll check it out.
    – paul
    Commented Apr 27, 2011 at 6:22
  • just updated my answer with a console app to show what delegates are registered Commented Apr 27, 2011 at 7:24
  • I had wondered if it were possible to do this. Thanks!!
    – paul
    Commented Apr 27, 2011 at 8:10
4

A left field idea is that the CSS in the two environments is not the same. That could happen for any number of reasons, but is it possible that the search box is simply hidden in production? Check the DOM to see if the markup is actually there, but not displayed.

1
  • Checked the DOM aleady but there is no sign at all of any kind of search box.
    – paul
    Commented Apr 27, 2011 at 6:04
0

I assume you're using SP2010? Are you using the searchbox in a Search Center? If so, do you use the minimal.master or did you switch the masterpage to v4 in the Search Center? If so check the contents of the breadcrumb (folder icon at the top of the page), you'll probably find it there.

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.