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

  • Home
  • SEARCH
  • 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 944925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:40:22+00:00 2026-05-15T22:40:22+00:00

tl:dr version: Is there a way to get the panels to render as divs

  • 0

tl:dr version:

Is there a way to get the panels to render as divs when rendered by RenderControl?

Background:

I am working on an asp.net 1.1 site, and I am trying to render a control containing panels to a string so I can pass it back to the page as JSON and refresh part of the page.

I am rendering the control thusly:

StringWriter twHeader = new StringWriter();
Html32TextWriter HeaderWriter = new Html32TextWriter(twHeader);             
MyHeader.RenderControl(HeaderWriter);
HeaderWriter.Close();
string HeaderHtml = twHeader.ToString()

When navigating to a page containing a MyHeader control, the panels within that control are rendered as divs. However, when I call RenderControl on MyHeader, the panels are rendered as tables, so when the page is updated with HeaderHtml, the layout blows up.

Is there a way to get the panels to render as divs when rendered by RenderControl?

Additional Information:

When I first looked into the problem I thought it might be a browsercaps issue, but when I looked at the web.config I saw that we already have browsercaps set as per this site: http://slingfive.com/pages/code/browserCaps/

I think I could get around this problem by using <div runat="server"> instead of panels, and in the end this might be the best solution, but at this point I am very curious if there is a way to get the panel to do what I want it to.

  • 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-15T22:40:22+00:00Added an answer on May 15, 2026 at 10:40 pm

    Before I saw Yellowfog’s answer, I went ahead and tried using server side divs instead of Panels. Ironically, I actually am using a class that inherits from Panel, and it happens to be called MyPanel: not sure if that earns Yellowfog a psychic badge, or a creepy badge 🙂 . The main reason I didn’t want to take this approach is because I didn’t write the MyPanel class, and didn’t want to have to deal with any changes to it I might have to make as a result of inheriting from HtmlGenericControl instead of Panel. But the switch was pretty painless, and it worked great.

    After reading Yellowfog’s answer, I thought I’d give his suggestion a whirl as well:

    public class MyPanel : Panel
    {
        //snip
    
        protected override void Render(HtmlTextWriter output)
        {
            output.Write("<div id=\"{0}\" class=\"{1}\"", this.ID, this.CssClass);
            this.RenderChildren(output);
            output.Write("</div>");
        }
    
        //snip
    }
    

    This also worked great.

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

Sidebar

Related Questions

I have an assembly. Is there a way to detect which version of .NET
Short version: Is there a simple way to get the value of a primary
Is there any way to include the SVN repository revision number in the version
Is there a standard way to associate version string with a Python package in
There is a way to know the flash player version installed on the computer
Is there a reliable way of detecting what version of Java is installed on
Is there a way to get the API level used by a given Android
Is there a way to get the link count from twitter to implement our
Is there any way to get remote JS file to chrome extension? My manifest.json
Short Version Is there a way to force (or provide a hint to) Microsoft

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.