asp.net.ph

BoundField.NullDisplayText Property

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.

Syntax


Inline <asp:boundfield emptydatatext = strText ... >
Script BoundField.NullDisplayText = strText

Property Value


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.

Remarks

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.

Example

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" />
See Also

BoundField Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph