System.Web.UI.WebControls Namespace ButtonField Class
.NET Framework version 2.0
Sets or retrieves the image to display for the buttons in a ButtonField.
Inline |
<asp:buttonfield imageurl = strImageUrl ... > |
Script |
ButtonField.ImageUrl = strImageUrl |
strImageUrl |
String specifying the path to the image file to display for the buttons in a ButtonField. |
The property is read/write with no default value.
Use the ImageUrl property to specify or determine the path to the image file to display for each button in a ButtonField control.
NOTE: When this property is set declaratively, all buttons in the column share the same image.
Alternatively, the ButtonField can be set to display different button images based on the values of a field in the data source bound to the parent control. To specify using a separate image file for each button in the column, programmatically set the ImageUrl property in the RowDataBound event of the parent control.
The following example demonstrates how to dynamically set the ImageUrl property to display different imagebuttons in a ButtonField column at run time.
ButtonField Members Adding Button Fields to a GridView Control