Class AjaxAttachments
Attachment-style upload control for forms that need a compact file list with remove support.
Implements
Inherited Members
Namespace: AjaxUploader.Controls
Assembly: AjaxUploader.dll
Syntax
public class AjaxAttachments : WebControl, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IPostBackDataHandler
Constructors
AjaxAttachments()
Initializes a new instance of the AjaxAttachments control.
Declaration
public AjaxAttachments()
Properties
ButtonText
Gets or sets the button text used to open the file picker.
Declaration
public string ButtonText { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Extensions
Gets or sets the allowed file extensions as a comma-separated list.
Declaration
public string Extensions { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
MaxFiles
Gets or sets the maximum number of files that can be attached through the control.
Declaration
public int MaxFiles { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
MaxSize
Gets or sets the maximum allowed file size.
Declaration
public string MaxSize { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
OnClientChange
Gets or sets the JavaScript callback invoked when the attachment list changes. The callback receives the client attachment state after uploads, removals, or other list updates.
Declaration
public string OnClientChange { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Removable
Gets or sets whether attached files can be removed from the client list.
Declaration
public bool Removable { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
ShowSize
Gets or sets whether file sizes are shown in the attachment list.
Declaration
public bool ShowSize { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
UploadUrl
Gets or sets a custom upload endpoint for attachment uploads. When left empty, the standard AjaxUploader handler upload endpoint is used.
Declaration
public string UploadUrl { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
UploadedFileGuids
Gets the uploaded file GUIDs restored from postback data. Use this list during page processing to associate attached files with the surrounding form data.
Declaration
[Browsable(false)]
public List<Guid> UploadedFileGuids { get; }
Property Value
| Type | Description |
|---|---|
| List<Guid> |
Methods
LoadPostData(string, NameValueCollection)
Loads the hidden attachment GUID list from postback data. The values are written by the client attachment widget into the hidden field rendered by the control.
Declaration
public virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| string | postDataKey | |
| NameValueCollection | postCollection |
Returns
| Type | Description |
|---|---|
| bool |
OnPreRender(EventArgs)
Raises the PreRender event.
Declaration
protected override void OnPreRender(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| EventArgs | e | An EventArgs object that contains the event data. |
Overrides
RaisePostDataChangedEvent()
Raises post-data changed notifications for the attachment control. This implementation is intentionally empty; inspect UploadedFileGuids during page processing.
Declaration
public virtual void RaisePostDataChangedEvent()
Render(HtmlTextWriter)
Renders the control to the specified HTML writer.
Declaration
protected override void Render(HtmlTextWriter writer)
Parameters
| Type | Name | Description |
|---|---|---|
| HtmlTextWriter | writer | The HtmlTextWriter object that receives the control content. |