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 8212311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:42:45+00:00 2026-06-07T10:42:45+00:00

Creating an ASP.NET AJAX Server Control. Overriding the RenderContents method, I placed in this

  • 0

Creating an ASP.NET AJAX Server Control. Overriding the RenderContents method, I placed in this code shown below:

protected override void RenderContents(HtmlTextWriter writer)
{
    var updatePanel = new UpdatePanel();
    updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
    updatePanel.ClientIDMode = ClientIDMode.AutoID;
    updatePanel.ID = "CaptchaUpdatePanel";
    updatePanel.ChildrenAsTriggers = true;

    //var placeHolder = new PlaceHolder();
    var hiddenField = new HiddenField();
    hiddenField.ID = "captchaKey";
    updatePanel.ContentTemplateContainer.Controls.Add(hiddenField);

    var panel = new Panel();
    panel.ID = "Captcha";
    var imgButton = new ImageButton();
    imgButton.ID = "RefreshCaptcha";
    imgButton.TabIndex = 0;
    imgButton.AlternateText = "Refresh Captcha Characters";
    imgButton.ImageUrl = RefreshButtonPath;
    imgButton.Width = 36;
    imgButton.Height = 36;
    panel.Controls.Add(imgButton);

    updatePanel.ContentTemplateContainer.Controls.Add(panel);

    AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
    trigger.ControlID = "CaptchaRefresh";
    trigger.EventName = "Click";
    updatePanel.Triggers.Add(trigger);

    updatePanel.ContentTemplateContainer.RenderControl(writer);

    base.RenderContents(writer);
}

Compiling the Control and dropping it onto a Web Forms page, I find that the UpdatePanel doen’t work. The button inside the UpdatePanel, when clicked, performs a complete postback not asynchronously.

Without success, I have been searching the web for an answer.

I’m wondering if it is a good idea to have an UpdatePanel within a AJAX Server Control. I have been successful performing this similer task using a UserControl.

HTML Script is below:

<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Register Assembly="CaptchaControl" Namespace="CaptchaControlx" TagPrefix="cc1" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <title></title>
    <script runat="server">

        protected void Page_Load(object sender, EventArgs e)
        {
            Label1.Text = DateTime.Now.ToString();
        }
    </script>
    <!--[if lt IE 9]>
        <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
</head>

<body>
    <form runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

    <cc1:captcha runat="server" />

    </form>
</body>
</html>
  • 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-06-07T10:42:47+00:00Added an answer on June 7, 2026 at 10:42 am

    UpdatePanel needs to be added in servercontrol at CreateChildControls function. So that it can be registered to ScriptManager as a updatepanel. While rendering it in RenderContents function, result in just html of UpdatePanel to be added in ServerControl.

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

Sidebar

Related Questions

I am creating a custom ASP.NET AJAX server control in which multiple instances of
I am creating a CompositeControl in VB ASP.NET. My control has an Ajax TabContainer
I'm creating asp.net special file manager. all file information saved to SQL Server table.
I am creating a user control in ASP.NET (using VB) that uses the autocomplete
I am calling an ASP.NET Ajax method (e.g. a method tagged with [Ajax.AjaxMethod] )
I'm using ASP.NET 3.5 + Ajax Control Toolkit + jQuery (NO MVC yet) I'm
Background: I'm creating a very simple chatroom-like ASP.NET page with C# Code-Behind. The current
I'm using ASP.NET AJAX Control Toolbox in ASP.NET 3.5 webform app; for each item
I'm creating an ASP.NET application (.NET 2.0) with C# and I'm using the AJAX
I'm creating a project in asp.net and I looking for Modal Window (like ajax

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.