SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to use a delegate control targeting "AdditionalPageHead" to add a control into the body of the page without resorting to javascript? The solution can't involve javascript as the control being added is a noscript tag.

I've successfully added the control into the page by adding an event listener to the Page's PreRender event. However, changes made to a page (publishing) are not saved when this is done. Is there another way to do this that doesn't invalidate changes made to a page being saved?

Update I've got something that looks to work that I'll keep testing. What (if any) downsides are there to this approach:

  • In the delegate control OnInit method, subscribe to page load event:

    this.Page.Load += new EventHandler(Page_Load);

  • In Page_Load event handler, add control to page's controls collection:

    HtmlGenericControl noscript = new HtmlGenericControl("noscript"); this.Page.Form.Parent.Controls.AddAt(this.Page.Form.Parent.Controls.IndexOf(this.Page.Form) + 1, noscript);

share|improve this question
You're approach sounds correct. What is not working? I'm unsure as to your comment about the publishing page. – Tim Gabrhel Apr 16 '12 at 18:26
Originally I was adding the control before the Form element, and this was keeping the publishing page it was used on from retaining any changes when a user edits it and saves. – JonTheNerd Apr 16 '12 at 19:17
I'd just like to get others' input on how best to implement this from a performance and functionality perspective. – JonTheNerd Apr 16 '12 at 19:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.