Glossary Item Box

PowerWEB TextBox for ASP.NET

Customizing File Uploads

PowerWEB TextBox for ASP.NET has built-in support for file upload and manipulation through the use of the ToolbarUploadButton. There are three basic default configurations for this type of button:

These buttons can be easily created and added to the toolbar using the techniques discussed in Configuring The Toolbar. The following code demonstrates adding a InsertImage button.

[C#]
// Be sure to add "Imports Dart.PowerWEB.TextBox" to the top of your code-behind class.
HtmlBox1.AddToolbarItem(ToolbarItemType.InsertImage);

[Visual Basic]
' Be sure to add "Imports Dart.PowerWEB.TextBox" to the top of your code-behind class.
HtmlBox1.AddToolbarItem(ToolbarItemType.InsertImage)

Once added to the toolbar, several properties control the behavior of the upload.

The following code demonstrates adding an ImageUpload button and setting some of these properties.

[C#]
// Be sure to add "Imports Dart.PowerWEB.TextBox" to the top of your code-behind class.
ToolbarUploadButton b = new ToolbarUploadButton(ToolbarUploadButtonType.InsertImage);

// Set the MaxFileSize to 1 MB
b.Upload.MaxFileSize = 1048576;

// Set the filter to accept jpgs and gifs only
b.Upload.Filter = "*.jpg,*.gif"

// Allow the user to delete files
b.Upload.AllowDelete = true;

// Add the button
HtmlBox1.Toolbar.Items.Add(b);

[Visual Basic]
' Be sure to add "Imports Dart.PowerWEB.TextBox" to the top of your code-behind class.
Dim b As New ToolbarUploadButton(ToolbarUploadButtonType.InsertImage)

' Set the MaxFileSize to 1 MB
b.Upload.MaxFileSize = 1048576

' Set the filter to accept jpgs and gifs only
b.Upload.Filter = "*.jpg,*.gif

' Allow the user to delete files
b.Upload.AllowDelete = True

' Add the button
HtmlBox1.Toolbar.Items.Add(b)

In This Section

Using HtmlBox Skins
Describes how skins can be applied to enhance the HtmlBox and how to create your own skins.
Creating a Custom Button
Describes how to create a custom button to call a JavaScript function.
Creating a Custom Dialog Button
Describes how to create a custom button which launches a dialog when clicked.
Creating a Custom Menu Button
Describes how to create a custom button which opens a menu when clicked.
Creating a Custom DropDown
Describes how to create a custom dropdown box.
Creating a Custom Toolbar Image
Describes how to create a custom toolbar image.
Creating Custom Toolbar Text
Describes how to create custom toolbar text.
Customizing File Uploads
Describes the built in upload support and how it can be customized.
Integrating Spell Checking
Provides steps of how to use a spell checker with the editor.
Integrating with Mail Applications
Provides information on how to integrate the HtmlBox with PowerTCP Mail for .NET to create mail applications which are capable of mailing HTML email messages.

 

 


Send comments on this topic.

Documentation version 3.2.0.0.

© 2009 Dart Communications.  All rights reserved.