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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:35:48+00:00 2026-06-18T23:35:48+00:00

Hi I am trying to use AjaxControlToolkit’s Accordion control in user control. That user

  • 0

Hi I am trying to use AjaxControlToolkit’s Accordion control in user control. That user control is added to page dynamically from code behind. My code for user control is as follows:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MyControl.ascx.cs" 
Inherits="Project.UC.Control" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="asp" %>

<asp:Accordion ID="Accordion1" runat="server" HeaderSelectedCssClass="Sel" 
HeaderCssClass="unSel" SelectedIndex="0">
<Panes>
<asp:AccordionPane runat="server" ID="AccordionPane1">  
<Header>Red Orchid</Header>  
<Content>Some content here.</Content>  
</asp:AccordionPane>  
</Panes>
</asp:Accordion>

To add user control dynamically I used following code in my page’s code behind

Control mycontrol = this.LoadControl("~/myUserControl.ascx");
this.Controls.Add(mycontrol);

On my user control consumer page I have form tag with runat=”server” also added ScriptManager control for ajax functionality. When I run my code I am getting following error

Control 'ctl02_Accordion1_AccordionExtender' of type 
'AccordionExtender' must be placed inside a form tag with runat=server. 

I already used form with runat=”server” tag on my consumer page why this problem is coming. To solve this problem I moved my consumer page’s form tag to user control this solves my problem but by doing this I can’t take advantage of postback on my consumer page. If I put form tag with runat=”server” in both user control and consumer page it show error that you can use only one form tag on page. How to solve this problem.

Thanks in advance..

  • 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-18T23:35:49+00:00Added an answer on June 18, 2026 at 11:35 pm

    Add a PlaceHolder control onto a form and instead of this.Controls.Add(mycontrol); use PlaceHolder1.Controls.Add(mycontrol);

    Or you need to add controls to form’s Controls collection. In assumption that form has aspnetForm id you should write: aspnetForm.Controls.Add(mycontrol);

    The reason is that Page class has own Controls property thus this.Controls.Add(mycontrol); line add control to Page.Controls collection. But all controls those submit any data to server must be placed in form element otherwise theirs values shouldn’t be accessible on server side. This follows from html forms mature: HTML Forms and Input

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

Sidebar

Related Questions

I am trying use a from a multi-dimensional array that I create in another
I've been trying to use the AutoComplete Extender from the ASP.NET Ajax Control Toolkit,
I'm trying use this code to get image resolution from file bool GetImageSizeEx(const char
i'm trying use facebook API to upload photo in my fan page. I downloaded
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
Trying to use Powershell to script the removal of specific custom errors from an
I'm trying use Places API from Google frmo a node.js server This is the
Im trying use the spinner control result in order to point it to another
I am trying use std::copy to copy from two different iterator. But during course
I'm trying use to selenium with firefox on CentOS from command line like this:

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.