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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:27:57+00:00 2026-05-14T21:27:57+00:00

I have an asp.net panel that contains a checkboxlist. I’d like to resize it

  • 0

I have an asp.net panel that contains a checkboxlist. I’d like to resize it so that its width fits the list’s contents snugly.

Right now I’m handling the panel’s pre rendering event, setting its width to match that of the checkboxlist. However it appears the checkboxlist’s width property reads zero (at least in this pre render method) so the panel’s width is set identically, which leads to inconsistent renderings in Firefox vs IE. Does anyone have a better approach to doing what I’m attempting here? Many thanks.

  • 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-14T21:27:58+00:00Added an answer on May 14, 2026 at 9:27 pm

    You could set the panel width onload per javascript:

    <script>
    function resizePanel() {
                var panel = document.getElementById('Panel1');
                var checkBox = document.getElementById('CheckBoxList1')
                if (panel != null && checkBox != null)
                    panel.style.width = checkBox.offsetWidth + "px";
    }
    </script>
    </head>
    <body onload="resizePanel()">
        <form id="form1" runat="server">
        <asp:Panel ID="Panel1" runat="server" BorderWidth="1" BorderColor="Silver">
        <asp:CheckBoxList ID="CheckBoxList1" Width="200px" runat="server">
        <asp:ListItem Text="Item 1" Value="1"></asp:ListItem>
        <asp:ListItem Text="Item 2" Value="2"></asp:ListItem>
        <asp:ListItem Text="Item 3" Value="3"></asp:ListItem>
        <asp:ListItem Text="Item 4" Value="4"></asp:ListItem>
        <asp:ListItem Text="Item 5" Value="5"></asp:ListItem>
        <asp:ListItem Text="Item 6" Value="6"></asp:ListItem>
        <asp:ListItem Text="Item 7" Value="7"></asp:ListItem>
        </asp:CheckBoxList>
        </asp:Panel>
        </form>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET 4 webpage that contains an update panel which just allows
I have an ASP.Net 2.0 page that contains two UpdatePanels. The first panel contains
I have an Asp.Net 4.0 website/control interface that uses an update panel and some
I have this serious: I have ASP.NET page, This page contents Update panel with
I am working on asp.net application and I have an update panel like this:
I have a custom ASP.NET user control that is added to a panel on
I have an ASP.NET Page that contains a User control called ReportCtrl (my own
I have a webpage that contains ASP.NET panels and JavasScript that expands and collapses
I have a webpage that contains ASP.NET panels and JavaScript that gets all of
I have an asp.net 3.5 update panel and I have a few textboxes that

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.