Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

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)

property bool Visible {
	bool get ();
	void set (bool value);

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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0
© 2015 Microsoft