DataControlField.Visible Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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)

member Visible : bool with get, set

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.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top