Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 502167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:15:51+00:00 2026-05-13T06:15:51+00:00

I am currently in the process of setting up AJAX capabilities in a SharePoint

  • 0

I am currently in the process of setting up AJAX capabilities in a SharePoint environment to support web parts I’m creating with C#. I am using Microsoft’s walkthrough as a starting point just to get up and running, and I am running into what I believe is a strange error. The problem is occurring in CreateChildControls():

    protected override void CreateChildControls()
    {

        base.CreateChildControls();

        //Fix for the UpdatePanel postback behaviour.
        EnsurePanelFix();

        LinkButton sayHello = new LinkButton();
        UpdatePanel refreshName = new UpdatePanel();
        ScriptManager scriptHandler = new ScriptManager();
        displayName = new Label();
        inputName = new TextBox();

        //Set up control properties.
        this.displayName.ID = "displayName";
        this.displayName.Text = "Hello!";
        this.inputName.ID = "inputName";
        sayHello.ID = "sayHello";
        sayHello.Text = "Say Hello";
        scriptHandler.ID = "scriptHandler";
        refreshName.ID = "refreshName";
        refreshName.UpdateMode = UpdatePanelUpdateMode.Conditional;
        refreshName.ChildrenAsTriggers = true;

        //Add the EventHandler to the Button.
        sayHello.Click += new EventHandler(ClickHandler);

        //Add the user interface (UI) controls to the UpdatePanel.
        refreshName.ContentTemplateContainer.Controls.Add(this.inputName);
        refreshName.ContentTemplateContainer.Controls.Add(sayHello);
        refreshName.ContentTemplateContainer.Controls.Add(this.displayName);

        //The ScriptManager control must be added first.
        this.Controls.Add(scriptHandler);
        this.Controls.Add(refreshName);
    }

The problem that I am having is that for some reason, CreateChildControls() must be called twice. When I step through the code, it executes every line with a problem, then goes back to the first line and repeats. When it gets to the second-to-last line where it adds the ScriptManager, it of course throws an exception, because it’s trying to add a second ScriptManager to the page with an identical key. Perhaps it’s an error in my understanding of how this method should work, but I don’t understand why it’s being called twice (or infinitely recursively, for all I know, if that exception weren’t thrown). Thanks for any help anyone can give me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:15:51+00:00Added an answer on May 13, 2026 at 6:15 am

    You could add a private flag at the class level – Check for it after your base.CreateChildControls() and bypass the remainder of the function if its set then set it when the scriptHandler is added, monitor in debug to make sure its not an infinite loop.

    Also check the call stack – CreateChildControls() may be called from different places.

    And, as a complete aside, have you tried Microsoft SharePoint Designer – I started developing web controls for SharePoint in VS 2005 with Ajax, but then found I could do most things using SharePoint Designer instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently in the process of creating API documentation using Microsoft Word 2007
I'm currently in the process of setting up a continuous integration environment at work.
I am currently in the process of setting up a tomcat 6 clustered environment,
I'm currently in the process of setting up a build server for a web
I'm in the process of setting up a proper CI environment and am currently
I currently have focused setting up a software configuration management process using svn, Jira
I'm currently in the process of setting my website, largely with php. Though this
I'm currently in the process of setting up a media server for my dorm
I'm currently in a process of creating a new C project and I have
I'm currently in the process of creating a Silverlight 3 data driven application. To

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.