GridAttachmentColumn
When you have attachments saved in your data source as a blob of binary data, GridAttachmentColumn provides you an easy way to upload to and download straight from your data source. In normal mode, GridAttachmentColumn displays a button to download the attachment associated with the respective data record. In edit mode, a RadUpload is provided for the user to upload an attachment into the data source.
Definition
Namespace:Telerik.Web.UI
Assembly:Telerik.Web.UI.dll
Syntax:
public class GridAttachmentColumn : GridEditableColumn, IStateManager, IComparable, IGridEditableColumn, IGridDataColumn
Inheritance: objectGridColumnGridEditableColumnGridAttachmentColumn
Implements:
Inherited Members
Constructors
public GridAttachmentColumn()
Properties
Gets or sets an array of file extensions that are allowed for uploading.
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
[TypeConverter(typeof(GridStringArrayConverter))]
public string[] AllowedFileExtensions { get; set; }
Gets or sets the name of the data field from the column's data source where the binary attachment data is stored.
public virtual string AttachmentDataField { get; set; }
Gets or sets a string, representing a comma-separated enumeration of DataFields from the data source, that uniquely identify an attachment from the column's data source
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
[TypeConverter(typeof(GridStringArrayConverter))]
public virtual string[] AttachmentKeyFields { get; set; }
A string, representing a comma-separated enumeration of DataFields from the data source, which form the unique key identifying an attachment from the column's data source
Gets or sets the CssClass of the button
public virtual string ButtonCssClass { get; set; }
Gets or sets a value indicating the type of the download button that will be rendered. The type should be one of the specified by the GridButtonColumnType enumeration.
public virtual GridButtonColumnType ButtonType { get; set; }
LinkButton Renders a standard hyperlink button. PushButton Renders a standard button. ImageButton Renders an image that acts like a button.
A string, specifying the ID of the datasource control, which will be used to retrieve binary data of the attachment.
public string DataSourceID { get; set; }
A string, specifying the ID of the datasource control, which will be used to retrieve binary data of the attachment.
Gets or sets a value from the specified datasource field. This value will then be displayed in the GridAttachmentColumn.
public virtual string DataTextField { get; set; }
Use the DataTextField property to specify the field name from the data source to bind to the Text property of the buttons in the GridAttachmentColumn object. Binding the column to a field instead of directly setting the Text property allows you to display different captions for the buttons in the GridAttachmentColumn by using the values in the specified field.
Tip: This property is most often used in combination with DataTextFormatString Property.
Gets or sets the string that specifies the display format for the caption in each button.
public virtual string DataTextFormatString { get; set; }
Use the DataTextFormatString property to provide a custom display format for the caption of the buttons in the GridAttachmentColumn.
Note: The entire string must be enclosed in braces to indicate that it is a format string and not a literal string. Any text outside the braces is displayed as literal text.
Gets or sets the file name of the attachment.
public virtual string FileName { get; set; }
Gets or sets the name of the field bound to the file name of the attachment.
public virtual string FileNameTextField { get; set; }
Gets or sets the format string applied to the value bound to the FileNameTextField property
public virtual string FileNameTextFormatString { get; set; }
Gets or sets a value indicating the URL for the image that will be used in a Image button. ButtonType should be set to ImageButton.
public virtual string ImageUrl { get; set; }
This property is supposed for developers of new grid columns. It gets whether a column is currently ReadOnly. The ReadOnly property determines whether a column will be editable in edit mode. A column for which the ReadOnly property is true will not be present in the automatically generated edit form.
public override bool IsEditable { get; }
A boolean value, indicating whether a specific column is editable.
Overrides:
Gets or sets the maximum allowed size (in bytes) of the uploaded attachment.
public int MaxFileSize { get; set; }
Gets or sets a value indicating the text that will be shown for a button.
public virtual string Text { get; set; }
Gets or sets a value indicating what type of upload control will be initialized during edit. (Default value = RadUpload)
public virtual GridUploadControlType UploadControlType { 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 ColumnEditorChange(IGridColumnEditor newValue)
Overrides:
protected override void CopyBaseProperties(GridColumn fromColumn)
Overrides:
protected override IGridColumnEditor CreateDefaultColumnEditor()
Overrides:
Extracts the values from the editedItem and fills the names/values pairs for each data-field edited by the column in the newValues dictionary.
public override void FillValues(IDictionary newValues, GridEditableItem editableItem)
dictionary to fill. This param should not be null (Nothing in VB.NET)
editableItemGridEditableItemthe GridEditableItem to extract values from
Overrides:
[SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
protected virtual void OnCellDataBound(object sender, GridCellDataBoundEventArgs args)
Get value based on the current IsEditable state, item edited state and ForceExtractValue setting.
public override bool ShouldExtractValues(GridEditableItem item)
item to check to extract values from
Returns:Overrides:
This method should be used in case you develop your own column. It returns true if the column supports filtering.