?
Solved

VScrollbar on Panel, always visible

Posted on 2009-02-10
5
Medium Priority
?
625 Views
Last Modified: 2012-05-06
Hi

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.
http://www.scoding.dk/example.jpg

The scrollbar makes it out of sync.

Any ideas are welcome
0
Comment
Question by:mSchmidt
  • 3
  • 2
5 Comments
 
LVL 19

Expert Comment

by:daveamour
ID: 23600061
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">
    <title></title>
</head>
<body>
    <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>
        </asp:Panel>
    </form>
</body>
</html>

Open in new window

0
 

Author Comment

by:mSchmidt
ID: 23600224
sorry we are talking winforms.
0
 
LVL 19

Expert Comment

by:daveamour
ID: 23600264
Right sorry and the panel is a fixed size right?
0
 

Author Comment

by:mSchmidt
ID: 23600270
correct, when adding additional elements, currently the scrollbar will pop up at some point.
0
 
LVL 19

Accepted Solution

by:
daveamour earned 2000 total points
ID: 23600287
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.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question