This documentation is archived and is not being maintained.

BoundColumn Class

A column type for the DataGrid control that is bound to a field in a data source.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

Public Class BoundColumn
	Inherits DataGridColumn
Dim instance As BoundColumn

public class BoundColumn extends DataGridColumn
public class BoundColumn extends DataGridColumn

Use the BoundColumn column type in a DataGrid control to display the contents of a field in the data source. The values are listed in a single column. The field is linked to the BoundColumn, so any updates in the data source will reflect in the corresponding cells of the DataGrid control.


This column type is the default for the DataGrid control.

To control appearance of this column, use the style properties of the DataGrid control.

Caution noteCaution

Text is not HTML encoded before it is displayed in the BoundColumn. This makes it possible to embed script within HTML tags in the text. If the values for this column come from user input, be sure to validate the values to reduce security vulnerabilities.

The following example demonstrates how to use a BoundColumn column type in the DataGrid control to display the fields in a data source.

<%@ Page Language="VB" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
   <script language="VB" runat="server">
	Function CreateDataSource() As ICollection
	    Dim dt As New DataTable()
	    Dim dr As DataRow
	    dt.Columns.Add(New DataColumn("IntegerValue", GetType(Int32)))
	    dt.Columns.Add(New DataColumn("StringValue", GetType(String)))
	    dt.Columns.Add(New DataColumn("CurrencyValue", GetType(Double)))
	    Dim i As Integer
	    For i = 0 To 8
	        dr = dt.NewRow()
	        dr(0) = i
	        dr(1) = "Item " + i.ToString()
	        dr(2) = 1.23 *(i + 1)
	    Next i
	    Dim dv As New DataView(dt)
	    Return dv
	End Function 'CreateDataSource

	Sub Page_Load(sender As Object, e As EventArgs)
	    If Not IsPostBack Then
	        ' Load this data only once.
	        ItemsGrid.DataSource = CreateDataSource()
	    End If
	End Sub 'Page_Load
   <form runat=server>
      <h3>BoundColumn Example</h3>
      <b>Product List</b>
      <asp:DataGrid id="ItemsGrid"

         <HeaderStyle BackColor="#00aaaa">






  • AspNetHostingPermission  For operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
  • AspNetHostingPermission  For operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0