GridImageColumn
Each cell in a GridImageColumn contains an image. To specify the image url of that image, you can do one of the following:
- Set the ImageUrl property to a static value. When you use this method, every image appears the same in the entire column.
- Set the DataImageUrlFields property to a field in the source that can be used to supply the image path and format it by
setting the DataImageUrlFormatString property. You can specify multiple fields if the image url is determined by more than one field in the database.
- Set the DataAlternateTextField property to specify by which field in the grid source the column will be sorted/filtered.
For the filtering you must also set explicitly the DataType property of the column to the type of the field specified through the DataAlternateTextField property (System.String in the common case). You can also apply format using the DataAlternateTextFormatString property.
Definition
Namespace:Telerik.Web.UI
Assembly:Telerik.Web.UI.dll
Syntax:
public class GridImageColumn : GridColumn, IStateManager, IComparable, IGridDataColumn
Inheritance: objectGridColumnGridImageColumn
Implements:
Inherited Members
Constructors
public GridImageColumn()
Fields
protected const string SuportedExtensions = "*.gif;*.jpg;*.jpeg;*.bmp;*.wmf;*.png"
Properties
Gets or sets whether the column data can be filtered. The default value is true.
public virtual bool AllowFiltering { get; set; }
A Boolean value, indicating whether the column can be filtered.
Implements:
Gets or sets a whether the column data can be sorted.
public virtual bool AllowSorting { get; set; }
A boolean value, indicating whether the column data can be sorted.
Implements:
Gets or sets a string, specifying the text which will be shown as alternate text to the image
public virtual string AlternateText { get; set; }
Gets or sets a string, representing the DataField name from the data source, which will be used to supply the alternateText for the image in the column. This text can further be customized, by using the DataTextFormatString property.
public virtual string DataAlternateTextField { get; set; }
A string, representing the DataField name from the data source, which will be used to supply the alternate text for the image in the column.
Gets or sets a string, specifying the format string, which will be used to format the alternate text of the image, rendered in the cells of the column.
public virtual string DataAlternateTextFormatString { get; set; }
A string, specifying the format string, which will be used to format the text of the hyperlink, rendered in the cells of the column.
Gets or sets a string, representing a comma-separated enumeration of DataFields from the data source, which will form the url of the image which will be shown.
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
[TypeConverter(typeof(GridStringArrayConverter))]
public virtual string[] DataImageUrlFields { get; set; }
A string, representing a comma-separated enumeration of DataFields from the data source, which will form the url of the image which will be shown.
Gets or sets a string, specifying the FormatString of the DataNavigateURL. Essentially, the DataNavigateUrlFormatString property sets the formatting for the url string of the image.
public virtual string DataImageUrlFormatString { get; set; }
A string, specifying the FormatString of the DataNavigateURL.
Gets or sets the image alignment of the column Image control.
public virtual ImageAlign ImageAlign { get; set; }
The image alignment of the column Image control.
Gets or sets the height of the image
public Unit ImageHeight { get; set; }
Gets or sets a string, specifying the url, from which the image should be retrieved. This property will be honored only if the DataImageUrlFields are not set. If either DataImageUrlFields are set, they will override the ImageUrl property.
public virtual string ImageUrl { get; set; }
A string, specifying the url, from which the image, should be loaded.
Gets or sets the width of the image
public Unit ImageWidth { get; set; }
Methods
Creates a copy of the current column.
public override GridColumn Clone()
Overrides:
Note: When implementing/overriding this method be sure to call the base member or call CopyBaseProperties to be sure that all base properties will be copied accordingly
protected override void CopyBaseProperties(GridColumn fromColumn)
Overrides:
Returns the DataField that will be used for Filter and Sorting operations
This method should be used in case you develop your own column. It returns the full list of DataFields used by the column. GridTableView uses this to decide which DataFields from the specified DataSource will be inlcuded in case of GridTableView.RetrieveAllDataFields is set to false.
public override IDictionary GetCustomPropertyDataFields(object dataItemInstance)
Overrides:
Calculate the default Group-by expression based on the settings of the DataField (if available)
public override string GetDefaultGroupByExpression()
Overrides:
For example, if a column's DataField is ProductType the default group-by expression will be: 'ProductType Group By ProductType'
This method should be used in case you develop your own column. It returns true if the column supports filtering.