Back to Devexpress

WebColumnBase.Caption Property

aspnet-devexpress-dot-web-dot-webcolumnbase.md

latest5.8 KB
Original Source

WebColumnBase.Caption Property

SECURITY-RELATED CONSIDERATIONS

Setting this property to values from an untrusted source may introduce security-related issues, since the property value is not encoded and is rendered as HTML markup. Call the HttpUtility.HtmlEncode method to encode the value.

Review the following help topic to better protect websites from cross-site scripting (XSS) attacks: HTML Encoding.

Gets or sets the text displayed within the column header.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue("")]
public string Caption { get; set; }
vb
<DefaultValue("")>
Public Property Caption As String

Property Value

TypeDefaultDescription
StringString.Empty

A String value that specifies the text displayed within the column’s header.

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the Caption property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

asp-net-mvc-grid-create-report-based-on-grid-layout/CS/E4755/Models/MVCxGridViewState.cs#L43

csharp
public GridViewDataColumnState(GridViewDataColumn column) {
    Caption = column.Caption;
    FieldName = column.FieldName;

aspxgridview-dataitemtemplate-runtime/CS/HyperlinkColumn/Default.aspx.cs#L48

csharp
colItemTemplate.Name = "colItemTemplate";
colItemTemplate.Caption = "Template Column";
ASPxGridView1.Columns.Add(colItemTemplate);

asp-net-web-forms-grid-create-report-based-on-grid-layout/CS/WebApplication1/ReportHelper.cs#L197

csharp
foreach(GridViewDataColumn dataColumn in visibleColumns) {
    ColumnInfo column = new ColumnInfo(dataColumn) { ColumnCaption = string.IsNullOrEmpty(dataColumn.Caption) ? dataColumn.FieldName : dataColumn.Caption, ColumnWidth = ((int)pagewidth / visibleColumns.Count), FieldName = dataColumn.FieldName, IsVisible = true };
    columns.Add(column);

asp-net-web-forms-grid-add-numbers-to-rows/CS/Default.aspx.cs#L5

csharp
protected void ASPxGridView1_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridViewColumnDisplayTextEventArgs e) {
    if (e.Column.Caption == "#") {
        e.DisplayText = e.VisibleRowIndex.ToString();

asp-net-mvc-grid-create-report-based-on-grid-layout/VB/E4755/Models/MVCxGridViewState.vb#L120

vb
Public Sub New(ByVal column As GridViewDataColumn)
    Caption = column.Caption
    FieldName = column.FieldName

aspxgridview-dataitemtemplate-runtime/VB/HyperlinkColumn/Default.aspx.vb#L43

vb
colItemTemplate.Name = "colItemTemplate"
colItemTemplate.Caption = "Template Column"
ASPxGridView1.Columns.Add(colItemTemplate)

asp-net-web-forms-grid-create-report-based-on-grid-layout/VB/WebApplication1/ReportHelper.vb#L203

vb
Dim column As New ColumnInfo(dataColumn) With {
    .ColumnCaption = If(String.IsNullOrEmpty(dataColumn.Caption), dataColumn.FieldName, dataColumn.Caption),
    .ColumnWidth = (CInt(pagewidth) \ visibleColumns.Count),

asp-net-web-forms-grid-add-numbers-to-rows/VB/Default.aspx.vb#L7

vb
Protected Sub ASPxGridView1_CustomColumnDisplayText(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxGridViewColumnDisplayTextEventArgs)
    If Equals(e.Column.Caption, "#") Then
        e.DisplayText = e.VisibleRowIndex.ToString()

See Also

WebColumnBase Class

WebColumnBase Members

DevExpress.Web Namespace