We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


VScrollbar on Panel, always visible

mSchmidt asked
Medium Priority
Last Modified: 2012-05-06

I have a application where i need a Panel to always show its Scrollbar even though it is currently not overflown.
The thing is that the size of the panels residing within the panel has to be the same at all times, because i have a fixed header which size is constant

An example of the issue.

The scrollbar makes it out of sync.

Any ideas are welcome
Watch Question

The attached code works for me.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PanelScrollBar.aspx.cs" Inherits="PanelScrollBar" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <form id="form1" runat="server">
        <asp:Panel runat="server" ID="MyPanel" Width="400" Height="300" ScrollBars="Vertical" BorderColor="Beige" BorderStyle="Solid">
            <p>This is some text</p>
            <p>This is some text</p>
            <p>This is some text</p>

Open in new window


sorry we are talking winforms.
Right sorry and the panel is a fixed size right?


correct, when adding additional elements, currently the scrollbar will pop up at some point.
Bit of a hack but add something just large enough to make the scrollbar always be there but hide it by making the colour so that it belnds in - don't actually set it's Visible property to false but just make it blend into the background.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.