Skip to main content
added 1151 characters in body
Source Link
Anders Rask
  • 17.9k
  • 3
  • 39
  • 71

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;
        }
    }
}

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

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;
        }
    }
}
Source Link
Anders Rask
  • 17.9k
  • 3
  • 39
  • 71

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