System.Web.UI.WebControls Namespace BoundField Class
.NET Framework version 2.0
Sets or retrieves the text to display in a BoundField when the field's value is null.
Inline |
<asp:boundfield emptydatatext = strText ... > |
Script |
BoundField.NullDisplayText = strText |
strText |
String specifying the text displayed in a BoundField when the field's value is null. |
The property is read/write with no default value.
Use the NullDisplayText property to specify a custom caption to display for fields that have a null value in a BoundField control.
When a record is being updated or inserted in a data-bound control, if the user enters the value specified by this property for a field in a data-bound control, that value is automatically converted to null in the data source.
If this property is not set, null field values are displayed as empty strings ( "" ).
NOTE: To convert an empty string field value to a null value, set the ConvertEmptyStringToNull property to true.
The following example demonstrates how to use the NullDisplayText property to specify the text to display when the data source bound to a BoundField control returns empty, or contains no data.
<asp:boundfield headertext = "Discount"
datafield = "discount"
dataformatstring = "{0:f2}%"
itemstyle-horizontalalign = "right"
nulldisplaytext = "No Data" />
BoundField Members