Glossary Item Box
While
[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 menu button
ToolbarMenuButton b = new ToolbarMenuButton(ToolbarMenuButtonType.Custom);
// Add some new items to the menu
b.Menu.Items.Add(new HtmlBoxMenuItem("Make Bold", "bold.gif", "pwFormat('bold', '', true);"));
b.Menu.Items.Add(new HtmlBoxMenuItem("Make Italic", "italic.gif", "pwFormat('italic', '', true);"));
b.Menu.Items.Add(new HtmlBoxMenuItem("Make Underline", "underline.gif", "pwFormat('underline', '', true);"));
b.Menu.Items.Add(new HtmlBoxMenuItem("Show alert", "custom.gif", "alert('hello')"));
// Add the button to the toolbar
HtmlBox1.Toolbar.Items.Add(b);
}
}
[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 menu button
Dim b As New ToolbarMenuButton(ToolbarMenuButtonType.Custom)
' Add some new items to the menu
b.Menu.Items.Add(New HtmlBoxMenuItem("Make Bold", "bold.gif", "pwFormat(""bold"", """", true);"))
b.Menu.Items.Add(New HtmlBoxMenuItem("Make Italic", "italic.gif", "pwFormat(""italic"", """", true);"))
b.Menu.Items.Add(New HtmlBoxMenuItem("Make Underline", "underline.gif", "pwFormat(""underline"", """", true);"))
b.Menu.Items.Add(New HtmlBoxMenuItem("Show alert", "custom.gif", "alert(""hello"")"))
' Add the button to the toolbar
HtmlBox1.Toolbar.Items.Add(b)
End If
End Sub
You can also call a function from the dialog.
[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 dialog button
Dim b As New ToolbarDialogButton(ToolbarDialogButtonType.Custom)
' Set the text of the dialog to whatever content you would like to display.
Dim text As String = ""
text = text & "<p>Click the button below to insert text from a dialog.</p>"
text = text & "<input type='button' value='click' onclick='pwInsertText(""Blah"", false, true)' ID="Button1" NAME="Button1">"
b.Dialog.Text = text
' Add the button to the toolbar
HtmlBox1.Toolbar.Items.Add(b)
}
}
[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 dialog button
ToolbarDialogButton b = new ToolbarDialogButton(ToolbarDialogButtonType.Custom);
// Set the text of the dialog to whatever content you would like to display.
string text = "";
text += "<p>Click the button below to insert text from a dialog.</p>";
text += "<input type='button' value='click' onclick='pwInsertText(\"Blah\", false, true)' ID="Button1" NAME="Button1">";
b.Dialog.Text = text;
// Add the button to the toolbar
HtmlBox1.Toolbar.Items.Add(b);
End If
End Sub
Send comments on this topic.
Documentation version 3.2.0.0.
© 2009 Dart Communications. All rights reserved.