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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:31:10+00:00 2026-06-07T17:31:10+00:00

I want to add dynamic literal control and dynamic button. so I try like

  • 0

I want to add dynamic literal control and dynamic button.

so I try like this:

            Literal lit = new Literal();        
            lit.Text = lit.Text + theRow["CaseExampleDescription"].ToString() + "\n\n";
            Button btn = new Button();
            btn.ID = "btn1";

            lit.Controls.Add(btn);

but there is error -System.Web.UI.WebControls.Literal’ does not allow child controls.

How can I solve this?

  • 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-07T17:31:11+00:00Added an answer on June 7, 2026 at 5:31 pm

    You need to use a container that would hold your child controls (like button, literal, etc.), thus it needs to implement WebControl Class.

    Literal is not deriving from system.Web.UI.WebControls namespace. Thus can not have collection of controls.

    Basically you need to use a server control as the base class that defines the methods, properties and events common to all controls in the System.Web.UI.WebControls namespace.

    How to do your task ?

    Read the following MSDN article – How to: Add Controls to an ASP.NET Web Page Programmatically

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

Sidebar

Related Questions

I have created a Dynamic View Panel custom control and want to add a
I want add new Feed item on entity persist and update. I write this
me created a zend form and want to add dynamic text box in it.
I want to make like dynamic control generation and I managed to put my
i want to add Layout Dynamically on Add button click and on Dynamic Layout
I want to add two dynamic text box to enter IP Range From to
In this page there's a way to dynamic add html (textbox,input button and radio
How do I add dynamic libraries in iphone xcode? I want to add the
I want to add a few dynamic rows right in the middle of a
Hello everybody I am drawing dynamic table and I want to add header for

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.