Glossary Item Box

PowerWEB TextBox for ASP.NET

Creating Custom Toolbar Text

Custom text (non-interactive text) can be added to the toolbar to enhance the editor. To do this, simply create a new ToolbarText, set the Text property, and add the ToolbarText to the toolbar. The following code snippet demonstrates creating adding "banner" text to the top of the toolbar.

[C#]
// Be sure to add "Using Dart.PowerWEB.TextBox" to the top of your code-behind class.

private void Page_Load(object sender, System.EventArgs e)
{
   // Check if it is the first page request. State will be maintained for additional postbacks.
   if(!Page.IsPostBack)
   {
      // Create a custom text
      ToolbarText banner = new ToolbarText(ToolbarTextType.Custom);
      
      // Change the style of the text to make it stand out
      banner.Width = new Unit("100%");
      banner.Font.Bold = true;
      banner.BackColor = Color.Red;
      banner.ForeColor = Color.White;
      
      // Set the text
      banner.Text = "Welcome to the PowerWEB HtmlBox for ASP.NET editor demo";

      // Add it as the first item, then add a row
      HtmlBox1.Toolbar.Items.Insert(0, banner);
      HtmlBox1.Toolbar.Items.Insert(1, new ToolbarImage(ToolbarImageType.RowSeparator));
   }
}

[Visual Basic]
' Be sure to add "Imports Dart.PowerWEB.TextBox" to the top of your code-behind class.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

   ' Check if it is the first page request. The toolbar will maintain its state for additional postbacks.
   If Not Page.IsPostBack Then
      ' Create a custom text
      Dim banner As New ToolbarText(ToolbarTextType.Custom)
      
      ' Change the style of the text to make it stand out
      banner.Width = New Unit("100%")
      banner.Font.Bold = True
      banner.BackColor = Color.Red
      banner.ForeColor = Color.White
      
      ' Set the text
      banner.Text = "Welcome to the PowerWEB HtmlBox for ASP.NET editor demo"

      ' Add it as the first item, then add a row
      HtmlBox1.Toolbar.Items.Insert(0, banner)
      HtmlBox1.Toolbar.Items.Insert(1, new ToolbarImage(ToolbarImageType.RowSeparator))
   End If
End Sub

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.