Setting the Footer Text
This topic demonstrates how to show a footer and set its text in C1GridView at design time and programmatically.
In the Designer
Complete the following steps:
1. Right-click the C1GridView control and then click Show Smart Tag. On the C1GridView Tasks menu, click Property builder. The C1GridView Properties window appears.
2. On the General tab, check the Show footer check box.
3. Select the Columns tab and uncheck Create columns automatically at run time.
4. Choose a column in the list of Selected columns.
5. Enter the desired text in the FooterText property.
In Source View
Switch to Source view and complete the following: steps:
1. Set the following text to the <cc1:C1GridView> tag::
• Set the AutoGenerateColumns property to False.
• Set the ShowFooter property to True.
It will appear similar to the following:
<cc1:C1GridView ID="C1GridView1" runat="server" AutoGenerateColumns="False" ShowFooter="True" DataSourceID="AccessDataSource1" VisualStylePath="~/C1WebControls/VisualStyles">
2. Set the footer text for individual columns using the FooterText property by adding the following <GroupInfo> tag within a <cc1:C1BoundField> tag, so it appears similar to the following:
<cc1:C1BoundField DataField="ProductName" HeaderText="Product" SortExpression="ProductName" DataFormatString="{0:c}">
</cc1:C1BoundField>
This will set the FooterText property.
In Code
Open the Code Editor and set the following properties in code:
• Set the AutoGenerateColumns property to False.
• Set the ShowFooter property to True.
• Set the footer text for individual columns using the FooterText property. This property must be set before the DataBind method is called.
For example, add the following code to the Page_Load event:
C1GridView1.AutoGenerateColumns = False
C1GridView1.ShowFooter = True
C1GridView1.Columns(0).FooterText = "Footer"
• C#
C1GridView1.AutoGenerateColumns = false;
C1GridView1.ShowFooter = true;
C1GridView1.Columns[0].FooterText = "Footer";
What You've Accomplished
This example sets the footer text for the first column to "Footer":
Note: The footer text can only be set for columns that are not automatically generated.
|