System.Web
2.0.0.0
System.Web.UI.WebControls.ButtonFieldBase
The class is used by data-bound controls (such as and ) to display a button for each record that is displayed. The object is displayed differently depending on the data-bound control in which it is used. For example, the control displays a object as a column, while the control displays it as a row.
Clicking a button in a button field raises the command event of the parent data-bound control. You can provide a custom routine to perform when a command button is clicked by providing an event handler for the command event.
The control raises the event, while the control raises the event.
To determine the index of the record that raises the command event, use the property of the event argument that is passed to the command event for the data-bound control. The class automatically populates the property with the appropriate index value.
To specify the type of button to display, use the property. When displaying a link or command button, use the property to specify the caption to display in the buttons.
If you set the property, all buttons in a share the same caption.
Alternatively, you can bind the object to a field in a data source. This allows you to display different captions for the buttons in the object. The values that are in the specified field are used for the text captions of the buttons. Set the property to bind a object to a field in a data source.
When displaying an image button, use the property to specify the image to display for the buttons in the object.
All buttons in a object share the same image.
You can hide a object in a data-bound control by setting the property to false.
The object allows you to customize its header and footer sections. To display a caption in the header or footer section, set the or properties, respectively. Instead of displaying text in the header section, you can display an image by setting the property. To hide the header section in a object, set the property to false.
Some data-bound controls (such as the control) can show or hide only the entire header section of the control. These data-bound controls do not support the property for an individual button field. To show or hide the entire header section of a data-bound control (if available), use the ShowHeader property for the control.
You also can customize the appearance of the object (font color, background color, and so on) by setting the style properties for the different parts of the field. The following table lists the different style properties.
-
Style property
The style settings for
-
The child Web server controls of the .
-
The footer section of the .
-
The header section of the .
-
The data items in the .
Represents a field that is displayed as a button in a data-bound control.
Constructor
Use the constructor to initialize a new instance of the class. This constructor is commonly used when adding fields to a dynamically created data-bound control.
To add a object dynamically to a data-bound control, create a new object, set its properties, and then add it to the field collection for the data-bound control. For example, if you are using the control, add the object to the collection.
Although you can add fields dynamically to a data-bound control, fields should be declared statically, and then shown or hidden, as appropriate. Statically declaring all of your fields reduces the size of the view state for the parent data-bound control.
Initializes a new instance of the class.
2.0.0.0
Property
System.ComponentModel.DefaultValue("")
System.String
To be added.
Use the property to associate a command name, such as "Add" or "Remove", with the buttons in the object. You can set the property to any string that identifies the action to perform when the command button is clicked. You can then programmatically determine the command name in an event handler and perform the appropriate actions.
All buttons in a object share the same command name.
Data-bound controls recognize certain command names and automatically raise and handle the appropriate events for the control. The following command names are recognized:
-
"Cancel"
-
"Delete"
-
"Edit"
-
"Insert"
-
"New"
-
"Page"
-
"Select"
-
"Sort"
-
"Update"
To invoke paging, set the to "Page" and the of the contained control to "First", "Last", "Prev", "Next", or a page number. However, since the for a control is always the integer row index, a control is not suitable for invoking paging. Similarly, while you can invoke sorting by setting the to "Sort", the property for a control is always the integer row index. For this reason, a control is not suitable for invoking sorting. For custom command names, such as "Add" and "Remove", you need to write the event code to check the command name and perform some custom action. For more information, see .
Not all command names are recognized by every data-bound controls. For example, "New" is not recognized by the control and "Select" is not recognized by the control.
The value of this property is stored in view state.
Gets or sets a string that represents the action to perform when a button in a object is clicked.
2.0.0.0
Method
System.Void
The method is a helper method that is used by the method to copy the properties of the current -derived object to the object that was created by the method.
Copies the properties of the current object to the specified object.
The to which to copy the properties of the current .
2.0.0.0
Method
System.Web.UI.WebControls.DataControlField
The method is a helper method that is used by the method of the base class to create an empty object to which to copy the properties of the current -derived object.
Creates and returns a new instance of the class.
A new instance of the class.
2.0.0.0
Property
System.ComponentModel.TypeConverter("System.Web.UI.Design.DataSourceViewSchemaConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
System.ComponentModel.DefaultValue("")
System.String
To be added.
When the property of a object is set to the or value, use the property to specify the name of the field to bind to the object. The values of the field are then displayed as the text for the buttons in the object. Optionally, you can format the displayed text by setting the property.
Instead of using the property to bind a object to a field from a data source, you can use the property to display static text for the text of the buttons in the object. When the property is used, each button shares the same caption.
If the and properties are both set, the property takes precedence.
The value of this property is stored in view state.
Gets or sets the name of the data field for which the value is bound to the property of the control that is rendered by the object.
2.0.0.0
Property
System.ComponentModel.DefaultValue("")
System.String
To be added.
Use the property to specify a custom display format for the values that are displayed in the object. If the property is not set, the value for the field is displayed without any special formatting.
The format string is applied only when the property is set.
The format string can be any literal string and usually includes a placeholder for the value for the field. For example, in the format string "Item Value: {0}", the {0} placeholder is replaced with the value for the field when it is displayed in the object. The rest of the format string is displayed as literal text.
If the format string does not include a placeholder, the value for the field from the data source is not included in the final display text.
The placeholder consists of two parts, separated by a colon and wrapped in braces, in the form { : }. The value before the colon ( in the general example) specifies the index for the field value in a zero-based list of parameters.
This parameter is part of the formatting syntax. Because there is only one field value in each cell, this value can only be set to 0.
The colon and the values after the colon are optional. The character after the colon ( in the general example) specifies the format in which to display the value. The following table lists the common formats.
-
Format character
Description
-
C
Displays numeric values in currency format.
-
D
Displays numeric values in decimal format.
-
E
Displays numeric values in scientific (exponential) format.
-
F
Displays numeric values in fixed format.
-
G
Displays numeric values in general format.
-
N
Displays numeric values in number format.
-
X
Displays numeric values in hexadecimal format.
Except for X, the format characters are not case sensitive. The X format character displays the hexadecimal characters in the case that is specified.
The value after the format character ( in the general example) specifies the number of significant digits or decimal places to display. For example, the format string "{0:F2}" displays a fixed-point number with two decimal places.
For more information on formatting strings, see Formatting Overview.
The value of this property is stored in view state.
Gets or sets the string that specifies the display format for the value of the field.
2.0.0.0
Method
System.String
To be added.
The method is a helper method that is used to transform a field value to the format that is specified by the property.
Formats the specified field value for a cell in the object.
The field value converted to the format specified by the property.
2.0.0.0
Property
System.Web.UI.UrlProperty
System.ComponentModel.DefaultValue("")
System.ComponentModel.Editor("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
System.String
To be added.
When the property of a object is set to the value, use the property to specify the image to display for each button. This image can be in any file format (.jpg, .gif, .bmp, and so on), as long as the client browser supports that format.
The value of this property is stored in view state.
Gets or sets the image to display for each button in the object.
2.0.0.0
Method
System.Boolean
The method is called by the data control with which the object is associated to perform basic object initialization for instances of the field, before the field is ever added to a rows collection. Data controls, such as and , call the method in their CreateChildControls methods before other methods, such as CreateRow, are called to create specific rows with data.
Call The method when you are writing a custom data-bound control that uses objects to perform basic initialization for a object. Implement this method if your -derived type requires any object initialization before it populates objects with data or controls in the method.
Initializes the current object.
false, which indicates the control does not need to rebind to the data.
true to enable sorting; otherwise, false.
The data control that owns the .
2.0.0.0
Method
System.Void
The method creates the button type that is specified by the property and adds it to the collection of the object. The property of the control is set to .
Initializes the specified object to the specified row state.
The to initialize.
A value that indicates the type of row (header, footer, or data).
One of the values.
The zero-based index of the row.
2.0.0.0
Property
System.ComponentModel.DefaultValue("")
System.ComponentModel.Localizable(true)
System.String
To be added.
When the property of a object is set to the or value, use the property to display static text for the caption of the buttons in the . Each button shares the same caption.
Instead of using the property to display static text in a object, you can use the property to bind the to a field in a data source. The values of the field are then displayed as the caption of the buttons.
If the and properties are both set, the property takes precedence.
The value of this property is stored in view state.
The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization.
Gets or sets the static caption that is displayed for each button in the object.
2.0.0.0
Method
System.Void
The method is a helper method that is used to determine whether the controls that are contained in a object support callbacks. This method is implemented as an empty method (a method that does not contain any code) to indicate that callbacks are supported.
The method is used primarily by control developers.
Determines whether the controls that are contained in a object support callbacks.
2.0.0.0