Visible Property

DataControlField.Visible Property


Gets or sets a value indicating whether a data control field is rendered.

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

Public Property Visible As Boolean

Property Value

Type: System.Boolean

true if the DataControlField is rendered; otherwise, false. The default value is true.

Use the Visible property to show or hide DataControlField objects in a data-bound control.

If the the Visible property is false, the data values are not displayed and do not make a round-trip to the client. If you want to round-trip the data for a field that is not visible, add the field name to the DataKeyNames property of the data-bound control.

The following code example demonstrates how to use BoundField and ButtonField objects, which are derived from DataControlField, to display rows in a DetailsView control. The Visible property of the BoundField object that displays the EmployeeID column is set to false, and the column is not rendered by the DetailsView control.

.NET Framework
Available since 2.0
Return to top
© 2015 Microsoft