ComponentOne GridView for ASP.NET AJAX: GridView for ASP.NET AJAX Task-Based Help > Formatting the Grid's Content > Adding a Caption to the Grid

Adding a Caption to the Grid

You can easily add a caption to the top of the grid by setting the Caption property. The following example sets the grid's caption to "Products".

In the Designer

Complete the following steps:

1.   Click the C1GridView control once to select it.

2.   Navigate to the Properties window and locate the Caption property.

3.   In the Caption property's text box, enter a string, for example "Products".

In Source View

Switch to Source view and add Caption="Products" to the <cc1:C1GridView> tag, so it appears similar to the following:

<cc1:C1GridView ID="C1GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource1" VisualStylePath="~/C1WebControls/VisualStyles" Caption="Products">

In Code

Add the following code to the Page_Load event to add a caption to the grid:

      Visual Basic

' Set the caption.

C1GridView1.Caption = "Products"

      C#

// Set the caption.

C1GridView1.Caption = "Products";

 What You've Accomplished

Run your application and observe that a caption now appears at the top of the grid:

 


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