ComponentOne Splitter for ASP.NET AJAX: Splitter for ASP.NET AJAX Task-Based Help > Applying CSS Styles to C1Splitter > Adding a Border to a Panel

Adding a Border to a Panel

The following topic illustrates how to apply a border style to the first panel of a C1Splitter control using CSS styles. At the completion of this topic, Panel1 of the C1Splitter control will have a thick, inset border that is lime green in color. To accomplish this task, you'll create a CSS style sheet, add a class specifying border styles to that style sheet, and then call that class by setting Panel1's CSSClass property.

Complete the following steps:

1.   Add a C1Splitter control to your Web project. 

2.   In Solution Explorer, right-click on the project name and select Add New Item.

      The Add New Item dialog box appears.

3.   In the Add New Item dialog box, complete the following tasks:

a.   From the Templates pane, select Style Sheet.

b.   Enter "BorderStyle.css" into the Name field.

c.    Press Add to close the Add New Item dialog box.

BorderStyle.css is added to your project.

 

Description: D:\Whidbey\T109\C1Splitter\WordDocuments\TBH\CSSBorder_CSSAdded.png

 

4.   In Solution Explorer, double-click BorderStyle.css to open the file in Visual Studio. The CSS body style appears by default:

5.  

body {

}

 

6.   Place the following CSS code after the right bracket of the body  style:

7.  

.C1Splitter_Border

 

{

       border-style:inset;

       border-width:thick;

       border-color:Lime;

}

 

8.   Return to the Design view of your .aspx page and complete the following tasks:

a.   Right-click the C1Splitter control to open its context menu and select Properties

C1Splitter's properties take focus in the Properties window.

b.   Expand Panel1's node and set the CSSClass property to "C1Splitter_Border".

 

Description: D:\Whidbey\T109\C1Splitter\WordDocuments\TBH\CSSBorder_EnterClassName.png

 

9.   Now you will have to link the Web project to the BorderStyle.css style sheet by calling it in the project's Source code. To link the style sheet to the project, click the Source tab to switch to Source view and place the following line of code between the <head> tags:

 

<link href="BorderStyle.css" type="text/css" rel="stylesheet"/> 

 

10.  Press F5 to run the program. Observe that Panel1 has adopted the border styles specified in the BorderStyle.css style sheet.

Description: D:\Whidbey\T109\C1Splitter\WordDocuments\Other Graphics\10.png This Topic Illustrates the Following:

By completing the steps in this topic, you have added a thick, lime green inset border to Panel1 of the C1Splitter control. The final product will resemble the following image:

 

Description: D:\Whidbey\T109\C1Splitter\WordDocuments\TBH\CSSBorder_Final.png


Send comments about this topic to ComponentOne.
Copyright © 1987-2010 ComponentOne LLC. All rights reserved.