asp.net.ph

ButtonField.ImageUrl Property

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.

Syntax


Inline <asp:buttonfield imageurl = strImageUrl ... >
Script ButtonField.ImageUrl = strImageUrl

Property Value


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.

Remarks

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.

Example

The following example demonstrates how to dynamically set the ImageUrl property to display different imagebuttons in a ButtonField column at run time.

Dynamically Generated ButtonField ImageButtons
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