While working on a custom SharePoint 2010 master page I had a situation where the ContentPlaceHolder called PlaceHolderSearchArea was rending the search box in a way that was not meeting the requirements set forth in the design. Instead of trying to mess with changing the way the content was being rendered into the ContentPlaceHolder I thought I could take a short cut and just set it’s visibility to false, wrap the SmallSearchBox delegate control with the styles and images I wanted and then place them outside of the ContentPlaceHolder.
Initially this seemed to work out well and I was very happy with the results. I had seen several other people recommend doing this in SharePoint 2007 so I figured there wouldn’t be any issue in SharePoint 2010. That assumption was very wrong.
About a week after I had deployed the branding into our development environment I had a person who was working on InfoPath forms tell me that there was a problem with SharePoint. He was getting the error “This page has been modified since you opened it” each time he tried to create a workflow on a document library. After a bit of troubleshooting I was able to determine that the issue was indeed caused by a problem in our custom master page… I just didn’t know what was causing the issue. I spent the next few hours going line by line through the master page looking for any potential issues. Finally I decided to start taking chunks of the custom master page and placing them into the default V4.master until something broke. After about another hour of fiddling around I located the problem. It was caused by a combination of setting the ContentPlaceHolder’s visibility to false and placing the search delegate control outside of that place holder.
To resolve the issue I created a custom control that inherits from SearchBoxEx. In the control I had it render out the additional custom branding I needed. I then created a new control feature which would cause my new control to be rendered instead of the default SearchBoxEx whenever the delegate control SmallSearchInputBox was rendered.
I deployed the update solution package and then created a new workflow on a document library. Success!