asp.net.ph

ButtonField.Text Property

System.Web.UI.WebControls Namespace   ButtonField Class


.NET Framework version 2.0

Sets or retrieves the text caption to display for the buttons in a ButtonField.

Syntax


Inline <asp:buttonfield text = strText ... >
Script ButtonField.Text = strText

Property Value


strText String specifying the text caption for the buttons in a ButtonField.

The property is read/write with no default value.

Remarks

Use the Text property to specify or determine the text caption to display for each button in a ButtonField control.

NOTE: When this property is set, all buttons in the column share the same text caption.

Alternatively, the ButtonField can be set to display different button captions based on the values of a field in the data source bound to the parent control. To specify using a separate text caption for each button in the column, set the DataTextField property instead.

NOTE: The DataTextField and Text properties cannot both be set at the same time. If both properties are set, the DataTextField property takes precedence.

Example

The following example demonstrates how to use the Text property to specify the text caption for button controls in two ButtonField columns. Notice that all buttons in both columns will render the same text caption.

<columns>

   <asp:buttonfield text = "Add"
      commandname = "AddToCart"  />

   <asp:buttonfield text = "Remove"
      commandname = "RemoveFromCart" />

   ...

</columns>
GridView ButtonField Example
Run Sample | View Source
See Also

ButtonField Members   Adding Button Fields to a GridView Control 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