Click here to Skip to main content
Click here to Skip to main content

ASP.NET Splitter Bar - Resize panels, table cells, and controls

By , 10 Mar 2008
 

Screenshot - VwdCmsSplitterBar.gif

  • Try out the SplitterBar online: SplitterBar Online Demo
  • The VwdCms.SplitterBar now supports both vertical and horizontal orientations

Introduction

The VwdCms.SplitterBar control is designed to give you column resizing in a two-column page layout. Use the splitter bar to resize a panel, div, table cell, or just about any control.

This control is ideal for pages that have a tree or a list of data items that vary in width.

The screenshots at the top of this article are an example of the VwdCms.SplitterBar in use, with a TreeView control in the left column of a table and a TextArea control in the right column. See the demo project (Example 1) for information on the TextArea sizing, scrolling, and text wrapping issue in IE 6 and IE 7, and how to overcome it.

Using the Control

Suggestion: Download the demo project rather than only the code for the control, as the demo project has many examples of how to use the control and how not to use it. The demo project has lots of descriptions and explanations of how to do things, so I won't bother repeating all of that information in this article.

To add the VwdCms.SplitterBar control to your project, just follow these steps:

Step 1: Copy these files into your project directory:

  1. /App_Code/SplitterBar.cs
  2. /VwdCmsSplitterBar.js
  3. /vsplitter.gif

Step 2: Add the VwdCmsSplitterBar.js file to the HEAD section of your Web Form:

<head runat="server">
    <title>VwdCms SplitterBar Web Form</title>
    <script src="VwdCmsSplitterBar.js" type="text/javascript"></script> 
</head>

Step 3: Update your web.config file's Controls section (inside the system.web section):

    <pages>
        <controls>
            <add tagPrefix="VwdCms" namespace="VwdCms"/> 
        </controls>
    </pages>

Step 4: Add a VwdCms.SplitterBar control to your Web Form:

    <VwdCms:SplitterBar runat="server" ID="vsbSplitter1" 
        LeftResizeTargets="tdTree1;divTree1" 
        MinWidth="100" 
        MaxWidth="700"
        BackgroundColor="lightsteelblue" 
        BackgroundColorLimit="firebrick"
        BackgroundColorHilite="steelblue"
        BackgroundColorResizing="purple"
        SaveWidthToElement="txtWidth1"
        OnResizeFunction="splitterOnResize"
        style="background-image:url(vsplitter.gif);
            background-position:center center;
            background-repeat:no-repeat;"/>

An example of the OnResizeFunction:

<script language="javascript" type="text/javascript"><!--

    function splitterOnResize(width)
    {
        // do any other work that needs to happen when the 
        // splitter resizes. this is a good place to handle 
        // any complex resizing rules, etc.

        // make sure the width is in number format
        if (typeof width == "string")
        {
            width = new Number(width.replace("px",""));
        }

        // now do something...
    }
    
// -->
</script>

An example of the table that this VwdCms.SplitterBar is connected to:

    <div style="margin:0px;padding:0px;
    width:800px:overflow:hidden;">
    <table border="0" cellpadding="0" 
        cellspacing="0" 
        style="width:800px;height:200px;
        border:solid 1px #6699CC;">
        <tr style="height:200px;">
            <td id="tdTree1" 
            style="width:250px;height:200px;" 
            align="left" valign="top"> 
              <div id="divTree1" 
                style="width:100%;height:100%;overflow:auto;
                padding:0px;margin:0px;">
                <asp:TreeView ID="tvwFramework1" 
                runat="server" ShowLines="True"
                style="width:100%;height:100%;
                padding:0px;margin:0px;">
                <Nodes>
                <asp:TreeNode Text=".NET Framework" 
                Value=".NET Framework">
                <asp:TreeNode 
                Text="System.Diagnostics" 
                Value="System.Diagnostics">
                <asp:TreeNode 
                Text="Debug Class" 
                Value="Debug"></asp:TreeNode>
                <asp:TreeNode 
                Text="DebuggableAttribute.DebuggingModes 
                Enumeration" 
                Value="DebuggableAttribute.DebuggingModes 
                Enumeration"></asp:TreeNode>
                <asp:TreeNode 
                Text="EventLogPermissionEntryCollection 
                Class" 
                Value="EventLogPermissionEntryCollection 
                Class"></asp:TreeNode>
                </asp:TreeNode>
                </asp:TreeNode>
                </Nodes>
                </asp:TreeView>    
              </div>            
            </td>
            <td id="tdMid1" 
            style="height:200px;width:6px;
            background-color:lightsteelblue;"></td>
            <td id="tdEdit1" 
            align="left" valign="top" 
            style="height:200px;"> 
                    <textarea runat="server" 
                    id="txtEdit1" 
                    style="margin:0px;height:100%;width:100%;
                    padding:0px 0px 0px 5px;
                    border:none;"></textarea>
            </td>
        
        </tr>
    </table>
    <span style="font-family:Verdana:font-size:10pt;">
    Current Width: 
    </span>
    <input type="text" id="txtWidth1" 
    value="250px" 
    style="width:70px;font-family:Verdana:font-size:10pt;"/>
    </div>

More Usage Examples

You can download many other examples of how to use the SplitterBar by clicking the 'Download demo' link at the top of this article.

Points of Interest

The most challenging part about building this control was the JavaScript and DHTML, because I wanted it to work in both IE and Firefox. At first, it seemed like the task would be pretty straightforward, but as I started testing and building the demo project examples, I kept finding little bugs that needed to be addressed. It can become pretty time consuming to hunt down all of these little issues, and I did my best to try to deal with most of them. If you find bugs, feel free to fix them and reply to this article with your suggestions for improvements.

When you try to implement the SplitterBar, you may find that your page is not behaving as you expected. I would like to warn you in advance about this - most of the issues that I found after I completed the control could be addressed by adjusting the CSS styles on the table or controls that I was applying the SplitterBar onto. Many times, our initial reaction is to think that a problem with the column resizing means that there is something wrong with the SplitterBar, and that is certainly possible, but I found that not to be the case most of the time.

The DOCTYPE (markup format specification) that you choose will have a profound impact on how your content is rendered by the browser. If you are having trouble getting styles to work as you expect, you may want to try using a different DOCTYPE. If you are getting strange results or it seems like the browser is ignoring your style settings, it it is interesting and worth the time to try rendering the page with no DOCTYPE at all. Completely remove it from the document, as some browsers, like IE 7, will still pick up the DOCTYPE even if it is commented out.

The demo project Web Forms are using the following DOCTYPE:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

History

I have updated the VwdCms.SplitterBar based on some of the suggestions that you have made. Here is a list of the what has been added or changed:

  • Built in persistence of column width after a postback.
  • Better support for dealing with IFrames.
  • Clean-up of the JavaScript code in VwdCmsSplitterBar.js.
  • More code examples in the demo project including postbacks.
  • Ability to specify how the SplitterBar will handle IFrames.
  • An entire demo page dedicated to IFrames.
  • Double-clicking to minimize and maximize the column width.
  • Changed the OnResizeFunction event to OnResize.
  • Added the OnResizeStart event.
  • Added the OnResizeComplete event.
  • Added the OnDoubleClick event.
  • Added code examples for using the OnResizeStart, OnResize, and OnResizeComplete event handlers in the demo project.
  • Updated to support Master Pages and Container Controls (Naming Containers):
    • C# and JavaScript code work together to determine the ClientID of an element.
    • SplitterBar checks to see if it is in a NamingContainer so it can find the controls during the postback.
    • Added a new example (#7) to the demo project to demonstrate the use of the SplitterBar with Master Pages.
  • Added the link to the SplitterBar online demo.
  • Added a GridView Column Resizing example to the demo project.
  • Added a Horizontal Row Resizing functionality to the SplitterBar, and a new example to the demo project.
  • Added code to account for the window/document scrollLeft and scrollTop so the SplitterBar will continue to work properly when the page has been scrolled down or to the right.
  • Added Example 10 to the demo project - this is an example of using the Vertical and Horizontal Splitter Bars together to create a table with a resizable left column, and in the right column there are two rows which are resizable.
  • Added persistence during postbacks for the MinWidth, MaxWidth, MinHeight, and MaxHeight properties.
  • Updated Example 10 in the demo project to demonstrate setting the MinWidth, MaxWidth, MinHeight, and MaxHeight properties.
  • Added better support for server side resizing. Now, setting the SplitterBar.LeftColumnWidth or SplitterBar.TopRowHeight will automatically resize the target controls during a postback.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Jeff Bazinet
Web Developer
United States United States
Member
VWD-CMS is an ASP.NET content management system designed and developed by Jeff Bazinet.

While VWD-CMS has been developed entirely in Visual Web Developer, it will power any ASP.NET 2.0 website.

VWD-CMS is a file based content management system that has been built with developers in mind -

one of the primary design requirements is that the CMS does not constrain or limit a developer.

Try the online demo and learn more about VWD-CMS at www.vwd-cms.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionNamespace Errormemberviru5detected15 Apr '13 - 16:27 
I'm getting the following error when I try to compile my application:
 
Quote:
The type or namespace name 'VwdCms' could not be found in the global namespace (are you missing an assembly reference?)

 
I'm using VS2010 with ASP4.0
Questionhow to use RightResizetargets propertymemberShrish198612 Dec '12 - 1:20 
Sir thanx for this control..
But my problem is what if i Flip the whole view vertically. every thing which is right to left becomes left to right. Now the controls for resizing will be on right of the splitter.
I have used the right resize property , but this is not working. plz help..
my email id is n.shrish@hotmail.com..
plz answer this query..
QuestionThe splitter is showing some width away from the td.memberShrish19863 Dec '12 - 19:53 
On page load the splitter is showing at a certain width away from the where i have applied it, but when i resize the td , the alignment becomes correct, and splitter is shown at the seperation.. any help
GeneralProblem with the splitter positionmemberMember 810781115 Jul '12 - 22:04 
I know this topic has been posted years ago but I have read it just a few days ago.
 
I am creating a vb.net site with a master page and tried your code in one of the pages.
 
It is just a simple table to check whether it will work correctly or not.
 
<VwdCms:SplitterBar ID="hsbHaulage" Orientation="Horizontal"
        TopResizeTargets="tdTop" BottomResizeTargets="tdBottom"
        DynamicResizing="true" runat="server"
        MinHeight="30" MaxHeight="370" TotalHeight="406"
        style="background-image:url(App_Theme/images/hsplitter.gif);background-position:center center;background-repeat:no-repeat;">
    </VwdCms:SplitterBar>
 
<table width="96%" border="1">
        <tr>
            <td id="tdTop">
                This example demonstrates a Horizontal VwdCms.SplitterBar implemented with
                    a table that has a fixed height and contains two rows/cells.
                    This example demonstrates a Horizontal VwdCms.SplitterBar implemented with
                    a table that has a fixed height and contains two rows/cells.
                    This example demonstrates a Horizontal VwdCms.SplitterBar implemented with
                    a table that has a fixed height and contains two rows/cells.
                    This example demonstrates a Horizontal VwdCms.SplitterBar implemented with
                    a table that has a fixed height and contains two rows/cells.
            </td>
        </tr>
        <tr>
            <td id="tdBottom">
                Test 2
            </td>
        </tr>
    </table>
 

I am using IE7. The splitter is appearing around 2 inches below the actual separator of the top and bottom rows. Can you help me?
 
I would like to show you the screen shot of what's happening but I don't know how to post an image.
 
I am not sure where to change the postition of the splitter? Isn't it automatic between the two rows it is dividing?
Questionsplitterbar not workingmembervikas@199016 May '12 - 21:56 
hi friends,
i have added this splliterbar with a leftsided div.
this div is inside updatepannel and having a treeview which is popoulating from table.all including splitter bar is working fine.but when i add a node to treeview and then click on splliterbar a runtime error occures errror is---- htmlfile: Unspecified error. and a line is coloured in vwdcmssplitter.js file line is...
var op = sbar.primaryResizeTarget.offsetParent;
 
my all control control is inside updatepannel excluding splliterbar.when i put splliterbar inside updatepannel it gives error.
 
please help
GeneralMy vote of 5membermanoj kumar choubey16 Feb '12 - 0:21 
Nice
QuestiononResizeFunction javascript function never firedmemberjncharli4 Jan '12 - 12:18 
Hi Jeff,
 
First of all, many thanks for such a great work.
 
I nevertheless have an issue.
I made a very simple test : the splitter bar works great, but the javascript function I set to the onResizeFunction parameter is never fired.
 
I tested with FF and IE, but none of the browser fires the javascript.
 
I had a look in the previous posts, but found nothing about a similar issue.
Am I the only one to have this issue (that would suggest I make a rough error) or is this an issue you already know ?
 
Best regards,
 
Some code ?
 
TestSplitterBar.aspx
 
 
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="TestSplitterBar.aspx.cs" Inherits="_Default" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
 
<br />
<br />
 
<script language="javascript" type="text/javascript"><!--
 
    function splitterOnResize(width) {
        // do any other work that needs to happen when the 
        // splitter resizes. this is a good place to handle 
        // any complex resizing rules, etc.
 
        alert("splitterOnResize");
 
        // make sure the width is in number format
        if (typeof width == "string") {
            width = new Number(width.replace("px", ""));
        }
 
        // now do something...
    }
    
// -->
</script>
 
<VwdCms:SplitterBar runat="server" ID="vsbSplitter1" 
    LeftResizeTargets="tdGauche;divGauche" 
    MinWidth="100" 
    MaxWidth="700"
    BackgroundColor="lightsteelblue" 
    BackgroundColorLimit="firebrick"
    BackgroundColorHilite="steelblue"
    BackgroundColorResizing="purple"
    SaveWidthToElement="txtWidth1"    
    OnResizeFunction="splitterOnResize"
    style="background-image:url(images/cmnSplitter.gif);
        background-position:center center;
        background-repeat:no-repeat;"/>
 
 <table width="100%">
    <tr>
        <td id="tdGauche">
            <div id="divGauche" style="width: 100%">
                <textarea id="TextArea1" cols="20" rows="2" style="width: 100%"></textarea>
            </div>
        </td>
        <td id="tdDroite">
            <div id="divDroite" style="width: 100%">
                <textarea id="TextArea2" cols="20" rows="2" style="width: 100%"></textarea>
            </div>
        </td>
    </tr>
</table>
 
<input type="text" id="txtWidth1" 
    value="250px" 
    style="width:70px;font-family:Verdana:font-size:10pt;"/>
 
<br />
</asp:Content>
 

 
 
TestSplitterBar.aspx.cs
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
using log4net;
using log4net.Config;
using System.Reflection;
using System.Data.Linq.Mapping;
using System.Collections.ObjectModel;
using System.Data;
 
public partial class _Default : System.Web.UI.Page
{
    // Log attributes
    // ==============
    private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 
    // Constants
    // =========
    private const string SPLITTERBARJAVASCRIPTNAME = "VwdCmsSplitterBar.js";
    private const string JAVASCRIPTNAME = "TestSplitterBar.js";
 
    protected void Page_Load(object sender, EventArgs e)
    {
        string sFunctionName = "Page_Load";
 
        _log.Debug(sFunctionName);
 

        // Common instructions whatever initialization or postback
        // -------------------------------------------------------
        // register the javascript scripts
        // -------------------------------
        JavascriptRegisterer.RegisterClientScriptBlock(Page, this.GetType(), SPLITTERBARJAVASCRIPTNAME, SPLITTERBARJAVASCRIPTNAME);
        JavascriptRegisterer.RegisterClientScriptBlock(Page, this.GetType(), JAVASCRIPTNAME, JAVASCRIPTNAME);                
    }
}
 
 
TestSplitterBar.js
 
 
window.onload = splitterOnResize("");
 

function splitterOnResize(width) {
 
    alert("splitterOnResize");
 
    document.getElementById("txtWidth1").value = "xx";
 
    // do any other work that needs to happen when the 
    // splitter resizes. this is a good place to handle 
    // any complex resizing rules, etc.

    // make sure the width is in number format
    if (typeof width == "string") {
        width = new Number(width.replace("px", ""));
    }
 
    // now do something...
}
 

GeneralProblem with "splitter bar" being offset out of tablememberHubman12 Sep '10 - 14:05 
Hi -
 
Cool program, but I am having a problem with a two column table. The splitter bar is in the right place, but it is about 20px below the top of the table AND it protrudes out the bottom of the table by the same distance (20px). I suspect this is some sort of style sheet issue, but I can't figure it out. I am using Visual Studio 2010 and a master document.
 
Thanx!
GeneralRe: Problem with "splitter bar" being offset out of tablememberHubman12 Sep '10 - 15:41 
OK - It's not a table or CSS that I define. I have a asp menu control above the table I have the splitter bar linked to. For some reason the menu control makes the slitter drop down and actually extends out of the bottom of the table I have it linked to. Example code below...
 
<form runat="server">
 
<table border="0" cellpadding="0" cellspacing="0" style="width:100%; ">
    <tr style="color:White; background-color:#4b6c9e;">
        <td style="text-align:left; vertical-align:middle; font-weight: bold; font-size: 40px; padding-left:20px; padding-top:10px; padding-bottom:10px;" >
        code Finder
        </td>
        <td style="text-align:right; color: White; padding-right: 15px;" >
            <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
                <AnonymousTemplate>
                    [ <a href="~/Account/Login.aspx" ID="HeadLoginStatus" style="color:White;" runat="server">Log In</a> ]
                </AnonymousTemplate>
                <LoggedInTemplate>
                    Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>!
                    [ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/"/> ]
                </LoggedInTemplate>
            </asp:LoginView>        
        </td>
    </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="width:100%; ">
    <tr style="background-color: #465c71;">
        <td>
            <asp:Menu ID="menuMain" runat="server" Orientation="Horizontal" 
            BackColor="#465c71" Font-Bold="False" ForeColor="White" 
            BorderColor="#465c71" BorderStyle="None" BorderWidth="1px" 
            DynamicHorizontalOffset="8" DynamicVerticalOffset="8">
                <StaticMenuStyle HorizontalPadding="5px" />
                <DynamicHoverStyle BackColor="#0033CC" ForeColor="White" />
                <DynamicMenuStyle BackColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" />
                <StaticHoverStyle BackColor="#0033CC" ForeColor="White" />
                <Items>
                    <asp:MenuItem NavigateUrl="~/Default.aspx" Text=" Home " Value="Home"></asp:MenuItem>
                    <asp:MenuItem Text=" Edit " Value="Edit">
                        <asp:MenuItem Text="Item 1" Value="Item1" NavigateUrl=""></asp:MenuItem>
                        <asp:MenuItem Text="Item 2" Value="Item2" NavigateUrl=""></asp:MenuItem>
                    </asp:MenuItem>
                </Items>
            </asp:Menu>  
        </td>
    </tr>
</table>
  <br />
 
<table border="0" style="width:100%;border:solid 1px black;" cellpadding="0" cellspacing="0">
    <tr>
        <td id="tdleft" style="width:30%; height:300px;" >
            left pane
        </td>
        <td id="tdright" style="background-color:Silver; padding-left: 5px;" >
            right pane<br />
        </td>
    </tr>
</table>
 
<div id="txtWidth1" style="text-align:center; " ></div>
 
<vwdcms:splitterbar runat="server" ID="vsbSplitter2" 
    LeftResizeTargets="tdleft" 
    MinWidth="150" 
    MaxWidth="600"
    BackgroundColor="lightsteelblue" 
    BackgroundColorHilite="steelblue"
    BackgroundColorResizing="purple"
    BackgroundColorLimit="firebrick"
    DynamicResizing="true"
    SaveWidthToElement="txtWidth1"
    OnResize="splitterOnResize"
	style="background-image:url(vsplitter.gif); background-position:center center; background-repeat:no-repeat;"
  />    
 
</form>
 

 

GeneralRe: Problem with "splitter bar" being offset out of tablememberCloudCasts22 Jan '12 - 11:11 
I'm getting the same... I'll look into it...
GeneralCompilation Error in VwdCms:SplittermemberAsifChouhan16 Jul '10 - 23:26 
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
 
Compiler Error Message: CS0433: The type 'VwdCms.SplitterBar' exists in both 'c:\Users\asif\AppData\Local\Temp\Temporary ASP.NET Files\root\a57b74b9\fdbaf83b\assembly\dl3\045d8289\fd752d06_8f25cb01\WebApplication1.DLL' and 'c:\Users\asif\AppData\Local\Temp\Temporary ASP.NET Files\root\a57b74b9\fdbaf83b\App_Code.7u_fe5ka.dll'
 
Source Error:
 
Line 766: </table>
Line 767: </div>
Line 768: <VwdCms:SplitterBar runat="server" ID="vsbSplitter1"
Line 769: LeftResizeTargets="tdTree1;divTree1"
Line 770: MinWidth="100"
 
Please sort my these problem. It is pending because of these error. Even I am not getting where I have made mistake I have followed each and every step in this.
 
Please get me out of these weird problem.
 
Regards
Asif
Generalonresize event in body or div tagmemberit-bergmann7 Dec '09 - 6:39 
Hi Jeff,
 
at first thanks for this great and easy to use control.
But I've a problem with FF 3.5 and IE8 when I add an onresize event to the body element.
<body onresize="alert('You have changed the size of the window')">
 
I also tried it with your samples but my alert is never displayed.
 
In IE I don't really need it because it's easy to fix while your SplitterBar onresize event work simular.
But using FF I found only a workaround to make a browser resize work.
 
Or I'm doing something wrong?
 
Thanks
 
Andre
GeneralRe: onresize event in body or div tagmemberJeff Bazinet7 Dec '09 - 6:53 
Hi Andre,
 
Try using the window.onresize event since this is supported by FF. I have not done any testing recently, but my past experience is that FF does not fire the onresize event until the operation is complete while IE fires the event while the window is being resized.
 
Also note that using an alert during a resize event will prevent you from being able to test it in IE so I usually put a textarea, txtDebug, on the page and write messages to that textarea so I can continue resizing without interuptions.
 
- Jeff Bazinet
VWD-CMS

GeneralRe: onresize event in body or div tagmemberit-bergmann7 Dec '09 - 22:04 
Hi Jeff,
 
window.onresize was the reason for that I recognize that it does not fire as I used your code posted here based on example 10 (vertical and horicontal scrollbars) for full screen size splittbars and FF browser resize takes no effect for the controls - for sure moving your bar does.
So I was not able to find a way for a working resize event with FF.
 
Thanks for the hint with the textarea.
Now I understand why this makes trouble with IE.
 
Andre
GeneralVB based ASP.NET conversionmemberHighFlight2k225 Sep '09 - 5:38 
Has anyone converted this over to a VB friendly version with the 2.0 framework?
 
Thanks very much.
 
Jon
GeneralScrollbars associated with the vertical splitter is not working Properly in IE 7.0memberMember 227048417 Sep '09 - 5:42 
I have a page which is vertically divided into two panes by splitter bar.In my left pane ,I have a treeview control.When the Children of any node goes beyond 30 or 40 ,its just displaying only some 10 nodes.(i.e)Vertical scrollbar associated with splitter is not working properly.However ,this is working fine in IE 6.0.If any one knows,please help me out at the earliest.
Generalsplitterbarmemberkomalahirwal16 Sep '09 - 2:20 
Hi,I am trying to remove scrollbars from splitterbar using scrollbar="None" but it is not working. Could you please resolve this one..
 
Thanks:
Komal
QuestionHow to keep persistent stage of width among all pages when we are using splitter in master page [modified]memberMember 340379417 Jul '09 - 11:48 
How to keep persistent stage of width among all pages when we are using splitter in master page.
 
In my application I am using left content placeholder and middle content placeholder.
In left I have menu and in right I have content and in middle I have splitter. on the first I am changing width of splitter from 150px to 20px and it is working fine, post back on same page is also working fine but when i go to another page it load default width 150px.I would like to keep it same among all pages once i change to minwidth or maxwidth.
 
I tried so many things but still it is not working so please help me in this case.
 
Waiting for someones reply....
 
modified on Monday, July 20, 2009 2:55 PM

AnswerRe: How to keep persistent stage of width among all pages when we are using splitter in master pagememberMember 405004621 Sep '09 - 20:05 
Even i am facing the same problem can any one help me out??
GeneralRe: How to keep persistent stage of width among all pages when we are using splitter in master pagememberMember 405004621 Sep '09 - 20:08 
Hi Jeff,
Could u please let us know any work around or solution for this problem.
GeneralRe: How to keep persistent stage of width among all pages when we are using splitter in master pagememberJeff Bazinet22 Sep '09 - 13:55 
Hi Guys,
 
Because you want the width to persist across postbacks and new page requests (changing the url is a new request even if the same master page is used) you will need to save the width in a cookie and then set it based on the cookie value.
 
The hidden field, hdnWidth, gets set in the LoadPostData function. You could check to see if the request is not a postback and then check the cookie value and set the width accordingly. Naming the value in the cookie should be based on the master page rather than the content page and the min and max values would need to be set as well since those are also being set during the postback.
 
I hope this is helpful.
 
Jeff
 
- Jeff Bazinet
VWD-CMS

GeneralLicense? [modified]memberSudhindra BK17 Jun '09 - 1:48 
Hi,
 
Is this Splitter Bar free ? If not, what is the pricing and whom can I contact for the same ?
 
Also, can this be deployed for commercial use ? Are there any issues ?
 
Regards,
Sudhindra BK
 
modified on Thursday, June 18, 2009 1:20 AM

GeneralLeftColumnWidth causes exception in Master PagememberMark Kestenbaum11 Jun '09 - 5:21 
Hi,
 
I put the splitter inside a master page and it worked fine, but when I tried to set the LeftColumnWidth property, an exception was thrown because the SetTargetControlWidths() method tried to check the Page.IsPostBack property when the Page was null.
 
Even taking out that check led to another exception in GetTargetControlIds because the NamingContainer was null.
 
Can anyone help?
 
Mark
GeneralCompile Error MessagememberMember 36923812 Jun '09 - 23:53 
I can't get past this problem:
 
Server Error in '/' Application.
--------------------------------------------------------------------------------
 
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
 
Parser Error Message: The base class includes the field 'vsbSplitter1', but its type (VwdCms.SplitterBar) is not compatible with the type of control (VwdCms.SplitterBar).
 
Source Error:
 

Line 92: </tr>
Line 93: </table>
Line 94: <VwdCms:SplitterBar runat="server" ID="vsbSplitter1"
Line 95: LeftResizeTargets="tdTree1;divTree1"
Line 96: MinWidth="100"

 
Source File: /WebForm1.aspx Line: 94
 
Anybody have an idea how to fix this? I am using VS2008
GeneralRe: Compile Error Messagememberarifpk3621 May '10 - 0:54 
Go to your .aspx.designer.cs page and there is a reference of VwdCms:SplitterBar remove this reference and build the code
Problem will solve
Arif Iqbal Khan
GeneralRe: Compile Error Messagemembersguruproject2 Aug '11 - 17:15 
Thanks,it is working
QuestionHow to use the splitter in arabic pagesmemberVimalSaifudin20 Apr '09 - 4:15 
Its working fine with treeview on left side but for arabic pages when the tree is moved on to the right side...its showing some problems... how can we make the splitter workable for arabic pages
QuestionHow can I make the direction of the table right to left.memberMember 309448811 Jan '09 - 10:51 
It works perfet when the treeview is on the left side. How can I put the treeview on the right side?
AnswerRe: How can I make the direction of the table right to left.memberVimalSaifudin20 Apr '09 - 4:20 
hi,
any way to make the control workable for rtl
GeneralRe: How can I make the direction of the table right to left.membermelwaer5 Nov '10 - 19:40 
Same problem
m_elwaer

Generalmessage shows "element 'SplitterBar' is not a known element"memberventure_luck17 Dec '08 - 23:09 
I 've configured as you said,howerver "<vwdcms:splitterbar runat="server" id="vsbSplitter1" xmlns:vwdcms="#unknown">
LeftResizeTargets="tdTree1;divTree1"
MinWidth="100"
MaxWidth="700"
BackgroundColor="lightsteelblue"
BackgroundColorLimit="firebrick"
BackgroundColorHilite="steelblue"
BackgroundColorResizing="purple"
SaveWidthToElement="txtWidth1"
OnResizeFunction="splitterOnResize"
style="background-image:url(vsplitter.gif);
background-position:center center;
background-repeat:no-repeat;"/>", shows message of "element 'SplitterBar' is not a known element,this can occur if there is a compilation in web site or the web config file is missting",Does it happen because of using in masterpage?
GeneralSplitter usememberMember 295449821 Nov '08 - 13:15 
Hi Jeff, good control.
 
I have one problem in that we dont use tables for layout so want to use a div as the left and right of the splitter.
 
im having problems with this as the right div isnt resizing.
 
Do you have any samples using this.
 
Thanks
Michael
GeneralASP.NET 1.1membernusoft247231 Oct '08 - 14:07 
I cannot find the link to the asp.net 1.1 demo
GeneralRe: ASP.NET 1.1memberVNVNV10 Aug '09 - 23:31 
I need a control like this for ASP.NET 1.1
QuestionCan I chabge the Min and Max HeightmemberUdeshang13 Oct '08 - 5:53 
Hi,
 
This is nice control but when I change its max height to 450 Min height to 100 total height to 550 than it behaved differently
 
how can I do it.
 
The reason for doing this is because it generates scroll bars with default height I dont want scroll bars thats why I am reducing its height.
 
Regards
 
Uday
AnswerRe: Can I chabge the Min and Max HeightmemberJeff Bazinet13 Oct '08 - 19:31 
Hi Uday,
 
It sounds like you need to set the overflow css style (or overflow-x, overflow-y) on the html element that has the scrollbar to 'auto' - it sounds like it is currently set to 'scroll'.
 
I hope this helps.
 
-Jeff
 
- Jeff Bazinet
VWD-CMS

QuestionIs this control work with Web application instead of a website?memberRamu.M11 Oct '08 - 8:35 
Hi.
 
I managed to use this code in a asp.net website.
 
when I try the similar code in a webproject it is showing the following error
 
Parser Error Message: The base class includes the field 'hsbSplitter', but its type (VwdCms.SplitterBar) is not compatible with the type of control (VwdCms.SplitterBar).
 
Source Error:
 

Line 155:
Line 156:
Line 157: <VwdCms:SplitterBar runat="server" ID="hsbSplitter" Orientation="horizontal"
Line 158: TopResizeTargets="tdTop"
Line 159: BottomResizeTargets="tdBottom"

 
Can't we use this control in a project of type Asp.net webApplication?
 
Thanks in Advance.
 
Thanks
Ramu
AnswerRe: Is this control work with Web application instead of a website?memberJeff Bazinet11 Oct '08 - 21:52 
Hi Ramu,
 
You could open up the SplitterBar.cs class in a separate Library project and compile it to a DLL, or write a batch file to compile it using CSC.exe. Then you could put the SplitterBar.dll file into your bin directory.
 
Does anyone else have a suggestion?
 
-Jeff
 
- Jeff Bazinet
VWD-CMS

GeneralAJAX and Panel Visibilitymemberdarkpaladin6 Oct '08 - 5:26 
Just a heads up, I noticed that if the splitter bar was in a panel where the visibility changed on an async postback the bar would disappear. If you're running into this problem, check out the RegisterPageStartupScript() method in the control. You need to change the following line:
 
this.Page.ClientScript.RegisterStartupScript(this.GetType(),
this.ClientID + "_VwdCmsSplitterBarStartupScript", sb.ToString());
 
to
 
ScriptManager.RegisterStartupScript(this, this.GetType(),
this.ClientID + "_VwdCmsSplitterBarStartupScript", sb.ToString(), false);
 
That should resolve your problem.
GeneralIt's really great but one issue, kindly help.membersc73803 Oct '08 - 0:46 
Hi my dear friend,
 
ypu really did a fantastic job.Splitter control has solved my problem
that I was facing since last so many days.
But there is an issue with monitors of different size.
Splitter is not working properly when I see my application in bigger screen.
I tested it on different monitor with different pixels
I developed my application on 15 inch monitor and on 21 inch monitor its not working properly
how would I solve this problem
kindly help.
plzzzzzz
 
Regards
Anu
AnswerRe: It's really great but one issue, kindly help.memberJeff Bazinet3 Oct '08 - 1:18 
Hi Anu,
 
It sounds like you might need to use some JavaScript to dynamically resize the splitter bar if the table or container that you are working with has resized due to a larger screen.
 
The easiest way to do this is by resizing the SplitterBar when the window object's resize event fires or on the body's onload event. Try calling the static function (you don't need a reference to a SplitterBar object) 'VwdCmsSplitterBar_reconfigure();' in one of these events. This method repositions all of the splitter bars on the page to line up with their 'resize target'.
 
I hope this helps!
 
-Jeff
 
- Jeff Bazinet
VWD-CMS

QuestionNot working with AJAX ????membersujit.patil7 Jul '08 - 1:29 
Hello Jeff,
I just tried to add spillter bar into a ajax enabled web site. But it is not working. Frown | :-(
I have followed all the steps still i got this error;
 
Unknown server tag 'VwdCms:SplitterBar'.
 
So can you help me sort out this problem.
QuestionProblem With Spillter bar [modified]membersujit.patil6 Jul '08 - 20:46 
Great work Jeff. It helped me in my project. This is the same what i want. Smile | :) Thanks for providing such simple way.
Actually my problem is, i have a table structure as follows;
<table>
   <tr>
         <td>
               <table>
                        <tr>
                              <td id="mainTd">
                                    <panel id="mainPanel">
                                             <table>
                                                   <tr>
                                                      <td>
                                                      </td>
                                                   </tr>
                                                   <tr>
                                                      <td>
                                                      </td>        
                                                   </tr>                                         
                              //same like there are many tr and tds here and i am showing one tr at a time for user depnding on menu                                         
                                       </table>                                            
                              ///All controls n all
                              </panel>
                           </td>        
            ////here i want a spillter bar
                              <td>
                                    <panel>
                                    </panel>  
                              </td>                                               
      </table>
 
Now i have added spillter bar like this;
<vwdcms:splitterbar runat="server" id="vsbSplitter1" xmlns:vwdcms="#unknown">
               LeftResizeTargets="mainTd;mainPanel"  
               MinWidth="370"
               MaxWidth="950"
               BackgroundColor="lightsteelblue"
               BackgroundColorLimit="firebrick"
               BackgroundColorHilite="steelblue"
               BackgroundColorResizing="purple"
               SaveWidthToElement="txtWidth1"
               OnResize="splitterOnResize"
               style="background-image:url(vsplitter.gif);
                    background-position:center center;
                    background-repeat:no-repeat;"/&gt;
 
There is some coding in my js and because of that one of <td> increasing its width at runtime. but the position of spillter bar same as it which results overlapping that over.
So what is the way to avoid this????
Hope so i have explain my problem well. If you want any explanation or code then i can give it to you.
Waiting for your reply.
And can we use it with AJAX also? Coz i want to use it with ajax also.

Sujit.
 
<div class="ForumMod">modified on Monday, July 7, 2008 2:53 AM</div>
GeneralError messagememberhifans.net25 Jun '08 - 6:02 
Thank you very much for this controll.
 
I got a error message, can you help me?
 
Message:
Base class include field 'vsbSplitter1', but it's type
(VwdCms.SplitterBar) is not compatible to the type of controller
(VwdCms.SplitterBar) .
 
Line 45: <p></p>
Line 46:
Line 47: <VwdCms:SplitterBar runat="server" ID="vsbSplitter1"
Line 48: LeftResizeTargets="tdTree1;divTree1"
Line 49: MinWidth="100"
 
PS. I am use VS2008.
 
Thank you!
 
Pegasus

AnswerRe: Error messagememberJeff Bazinet25 Jun '08 - 15:10 
Hi Pegasus,
 
Are you using AJAX.NET? Most of the problems that people report are because they are using AJAX.NET controls on the same form with the SplitterBar but this is not supported. If you are not using AJAX.NET and you are still getting this error message, please send more details.
 
Thanks!
 
- Jeff Bazinet
VWD-CMS

GeneralNot working properly in firefox with CollapsiblePanelExtender Control and PopUp ExtendermemberIrfanKhan25 Jun '08 - 5:16 
Hi Jeff,
 
Amazing Control.. Good Work. Smile | :)
 
But when I am using the VwsCms splitter with AjaxControlToolkit controls like CollapsiblePanelExtender Control and PopUpExtender Controls, its not working in fire fox.
 
Please suggest any way to solve the problem.
 
Thanks & Regards,
IrfanKhan
AnswerRe: Not working properly in firefox with CollapsiblePanelExtender Control and PopUp ExtendermemberJeff Bazinet25 Jun '08 - 15:08 
Hi IrfanKhan,
 
Thanks! I'm sorry to tell you that the SplitterBar has not been designed to support AJAX.NET (AjaxControlToolkit). I usually custom code my own Ajax controls so I don't have plans right now to add support for AJAX.NET.
 
- Jeff Bazinet
VWD-CMS

GeneralRe: Not working properly in firefox with CollapsiblePanelExtender Control and PopUp ExtendermemberIrfanKhan25 Jun '08 - 22:00 
Hi Jeff,
 
Thanks for your quick reply.
 
If you have any other solution to split the panels?
 
I have requirement that we have three columns for web parts which is in WebPartZones and I want to resize the webpartzones according to user.
 
Please suggest any way to sort out.
 
Thanks,
IrfanKhan
GeneralRe: Not working properly in firefox with CollapsiblePanelExtender Control and PopUp ExtendermemberIrfanKhan26 Jun '08 - 4:05 
Hii again,
 
Is there any way to Hide the VwdCms splitter bar?
 
If you know please provide guidance on it.
 
Thanks,
Irfan
AnswerPersist width to cookiememberJiaozi24 Jun '08 - 0:20 
Hello, thank you for this wonderful control. Very well written moreover.
I have added cookie persistence. Here is why:
 
Add two variable after this.namingContainerId = ""; (line 65)
this.persistCookieKey = null;
this.initialized = false;
 
Near line 277, add the following code (I support only vertical orientation, but horizontal is easy: just replace width by height)
if(!sbar.initialized && sbar.persistCookieKey)
{
  var width = getInt(readCookie(sbar.persistCookieKey));
  if(width > 0)
  {
      width = getInt(width);
      sbar.hdnWidth.value = width;
      sbar.primaryResizeTarget.style.width = width + "px";
  }
  sbar.initialized = true;
}
 
Now, the save part, line 563, before firing the onResize event.
 
// save width to cookie if needed
if(sbar.persistCookieKey)
{
   writeCookie(sbar.persistCookieKey, width, 365);
}
 
At the bottom of the file, add (from http://www.quirksmode.org/js/cookies.html#script[^]):
 
function writeCookie(name,value,days)
{
   if (days)
   {
      var date = new Date();
      date.setTime(date.getTime()+(days*24*60*60*1000));
      var expires = "; expires="+date.toGMTString();
   }
   else var expires = "";
   document.cookie = name+"="+value+expires+"; path=/";
}
 
function readCookie(name)
{
   var nameEQ = name + "=";
   var ca = document.cookie.split(';');
   for(var i=0;i < ca.length;i++)
   {
      var c = ca[i];
      while (c.charAt(0)==' ') c = c.substring(1,c.length);
      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
   }
   return null;
}

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 11 Mar 2008
Article Copyright 2007 by Jeff Bazinet
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid