| Article Information |
Using Numeric IDs with RicherComponents Controls casues exception
Using a numeric ID an ID with a numeric prefix - for example '15_RTB' will cause an exception when the page is parsed or a javascript exception of the Control is added programmatically and the ID set in code.
Solution: don't use an ID that is numeric or has a numeric prefix.
(... more)
|
How do I set the text in a hyperlink?
If you click the Insert Hyperlink button, it opens a dialog box from where you can specify the URL to link to, however it does not provide a field in which you can enter the text for the link. The easiest way to do this is to type the text into the document, select it, and then click the Insert Hyperlink button. (... more)
|
Multiple cultures on one page
Although RichTextBox v3.0 does not support multiple editors on the same page having different culture settings, we have due to demand, created an unsupported solution that allows this.
Please note that this is an unsupported interim solution which has undergone very little testing, and might therefore prove unstable in different circumstances.
The solution requires that you subclass the editor. You then need to override the OnPreRender method in which you temporarily (... more)
|
Implementing support for uploaded images
If you use the Insert Image button to add an image to the page from your local computer, it will just insert a reference to that image in the HTML and works best if you enter the full image URL including the hostname. In fact the Insert Image button is really only designed for using images already on the server as there are better ways to handle image uploading.
To add image uploading to your application, look at the free image upload gallery add-on for RichTextBox. (... more)
|
Integrating the color picker
You can easily add a color picker to RichTextBox:
Download the RichTextBox color picker ZIP file and open it up.
Inside it is colorpicker.aspx, which is a C# page. To convert it to VB.NET open the page and swap the reference to Request["editor"] over to Request("editor"). i.e. change the square brackets to rounded brackets.
Save the colorpicker.aspx file to your web application.
Turn on the font foreground color picker button and/or the font background color picker button. Or even (... more)
|
Multiple dictionaries on the same page
This solution allows you to have multiple RichTextBox instances on the same .aspx page use different dictionary files for the spell checking function.
You’ll need to override the spellcheck toolbar button on one of RichTextBox instances so that it calls a custom function to use the appropriate dictionary. I've included code below for achieving this - the other RichTextBox on the page will use the page culture to determine its dictionary.
This example needs a folder (... more)
|
Does RichTextBox support spell-checking?
Yes, spell checking is integrated in RichTextBox v2.0 professional edition, and a range of different dictionaries are available for free. This is not available in the standard edition, so if you wish to make use of it you need to upgrade. Contact us for upgrade pricing.
(... more)
|
Adding Richer Components Controls to the Matrix toolbox
To add Richer Components Controls to the toolbox:
Right-click on the toolbox and select "Add local toolbox components".
Click Browse and browse to the location of the appropriate DLL file.
Click Open.
The control will be added to the toolbox. You can then drag-and-drop it onto pages in design-view. You can also edit control properties using the property sheet.
(... more)
|
How to use RichCalendar with MySQL database?
Step by step process to connect to MySQL and implement RichCalendar through it.
Create a database with the same tables and schema as that of the ‘RichCalendar.mdb’ given in the ‘Data’ folder, which comes with the setup.
Create a DSN
Control panel à Administrative tools à Data Sources (ODBC)
An ODBC Data Source Administrator window appears.
Click on the ‘Add’, choose ‘MySQL ODBC 3.51 Driver’ and then ’Finish’.
An ‘add data source name’ window appears where you have to (... more)
|
Installing RichCalendar
Just three steps to install a RichCalendar component. they are,
Download the zip file.
Unzip it into a folder.
Click setup.msi and follow the instructions. (... more)
|
The value is returned is NULL or empty of DateTime field from a database
When the value is returned is NULL or empty of DateTime field from a database; the RDP component should empty instead of showing the selected date.
The solution consists of two points.
1) Set Nullable=true.
2) If fields from a database and the date value returned is NULL or empty.
Set SelectedDate = DateTime.MinValue
(... more)
|
Limit selection to a specified date range and specific days of the week
To limit selection to a specified date range and specific days of the week you'll need to implement code like that below. The dates outside the lower and upper bound dates are visible but can't be selected. The non selectable dates within the date range are not visible.
You can modify the styles as required.
In .aspx tag -
.notSelectable {Display: none}
.Selectable { FONT-SIZE: xx-small; COLOR: black; BACKGROUND-COLOR: yellow }
In C# c (... more)
|
RichDatePicker Properties Set in Page_Load cause Posted Date to be lost
Note: this is not an issue with RichDatePicker 1.5
If RichDatePicker properties are set in Page_Load (first example below) then the Posted Date state is not maintained so that it’s dropped when the page refreshes. This is a life cycle issue that may be rectified by setting the properties in the Page_Init method called by the OnInit event (second example below).
Example with Page_Load -
(... more)
|
Selects display over the top of the RichDatePicker Version 1.0
Note: this is no longer an issue with RichDatePicker 1.5
This behaviour occurs due to Select elements having an infinite z-index in the page meaning that they’ll always show on top of other page elements like the RichDatePicker calendar (div element).
The RichDatePicker has a property EnableHideDropDown that will hide all of the selects in the page temporarily when the calendar is displayed. If you don’t wish all the selects in the page to be hidden then you (... more)
|
Installing Richer Components Controls in Visual Studio .NET
To see the “bin” folder in Visual Studio .NET you will have to select the “Show All Files” option in the Solution Explorer. Drag the appropriate DLL (RichTextBox.dll for example) and the XML file into the bin folder and it will automatically add a reference to the assembly for you. Alternatively you may add the control to the Web Form's Toolbox (3. below) in which case the drop and drag of the control onto your .aspx page creates the appropriate DLL reference.
Drag the Images folder into (... more)
|
Installing RichHelpTip
Installation of RichHelpTip can be done in just three steps.
Download the zip file.
Unzip it into a folder.
Click setup.msi and follow the instructions. (... more)
|
Implementation of RichHelpTip
Implementing RichHelpTip can be done with the help of following steps:
1. Create a web application.
2. Add a reference to RichHelpTip.dll or add component .dll file to toolbox.
3. Copy ‘images’ folder and ‘helptips.xml’ file (located in ‘Samples’ folder of the ‘WebSamples’ folder ) into your application.
4. Drag and drop RichHelpTip component onto the webform.
5. Provide ‘imageUrl’ and ‘XmlFileUrl’ path.
6. Choose a HelpTip ‘id’ and (... more)
|
Installing RichNavigator
Download the zip file.
Unzip it into a folder.
Click setup.msi and follow the instructions.
You can locate the samples and other documents in program files folder.
(... more)
|
Implementation of RichNavigator
Its easy to implement RichNavigator. Here are few steps to help you.
Create a web application.
Add a reference of RichNavigator.dll or add component .dll file to toolbox. The component will be added as PanelBar to the toolbox by adding a single RichNavigator.dll file.
Copy and paste the ‘images’ and 'Examples' folders into your application from RichNavigator folder in wwwroot from 'vbnet' or 'csharp' folders according to the requirement.
Build the web application and (... more)
|
Align selected line of text only
When you click the left/right/center justify buttons it calls the execCommand method for the selected element and so moves all of the text (rather than just the selected line of text) as it's usually all in the same P element.
If you're using RichTextBox1.ReturnKeyBehavior = BreakMode.LineBreak; then you could implement the following so that it will only move the selected line of text.
Add an input button or new toolbar button with the following event and function (... more)
|
Using RichTextBox with RTF Documents/Strings
Using RichTextBox with RTF Documents/Strings
The Professional RichTextBox product can load an RTF file or RTF stream (LoadRTF method passing a file path or stream object as a parameter) however it's converted into HTML as the RichTextBox editor is an IFrame element. You can then edit the content client side which modifies the Html, but what you can't do is save it back/convert to and RTF format again using RichTextBox directly.
If you save your edited Html document (... more)
|
Extending or Overriding an existing ToolBar Item
You're able to override the existing RichTextBox toolbar menu selects and buttons or create new ones. The example below overrides and extends (still sets the Font as the current Select does) the existing Font select. Just add your own additional logic and you can do most that you'll require. The Documentation (Start/Programs/RichTextBox v2.0/Documentation) covers these classes and all their members.
In your .aspx.cs or server script -
protected (... more)
|
Printing Selective Content
The RichTextBox print toolbar button only prints the content of the RichTextBox editor with the following javascript -
RTB_Print(RichTextBox1_x5,RTB_HtmlMode_RichTextBox1());
function RTB_Print(editor,htmlmode)
{
editor.document.execCommand('print','',null);
}
If you wish to print selective content from the RichTextBox and other Text elements when the Print Toolbar button is clicked you’ll need to override the existing print button (... more)
|
Implementing Print Formatting
If you wish to apply specific formatting for printing the contents of the RichTextBox Edit pane, you can use the CSS2 @media rule which allows you to implement media specific styles. For a more detailed article on all the media types available and implementation syntax the following resource is most useful –
http://www.meyerweb.com/eric/articles/webrev/200001.html
This article will focus on the print and screen media types using the @media rule rather than Link or Import (... more)
|
Does RichTextBox work with Windows Forms?
RichTextBox is custom built from the ground up for ASP.NET following from our long history with the platform and our deep experience with it. Being a web component company, we do not sell components for Windows Forms desktop applications, however although we cannot supply you with an editor for Windows Forms, we can recommend TextControl, the market-leading editor for Windows Forms and COM applications. For more information see www.textcontrol.com. Please mention that you heard about them (... more)
|
Moving from a Previous/Evaluation Version of RichTextBox
Prior to installing the new version, do a complete search on the appropriate machine for RichTextBox.dll. Take a backup copy and delete from all other locations. Asp.Net often performs caching of .dlls so make sure your search all folders/directories to ensure that you find all the locations. You’ll likely find .dlls in sub directories of this path of similar depending on your OS and version of ASP.Net -C:\Winnt\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\
From your (... more)
|
How do I add a new language dictionary for the spell checker.
There are various options on how you can add new language dictionaries.
New dictionary files may be downloaded from the Additional Dictionaries section at -
http://www.richtextbox.com/richtextbox/support
1: Place the new .dictionary file within your web application /bin directory so that it beside your RichTextBox.DLL file.
This will allow the Spell Checker to automatically find the new dictionary without any other settings needed.
If your (... more)
|
How do I set up the Spellchecker spellchecker.aspx file.
Unless you have a specific reason, the spellchecker.aspx file that comes with the sample files should always be used.You will find the spellcheck.aspx file within the samples that came with the RichTextBox installer.
Use the appropriate file depending on the .NET Framework version running on your server.
Installed directory: \RichTextBox v2.0\SpellCheck\ASP.NET v1.0
Installed directory: \RichTextBox v2.0\SpellCheck\ASP.NET v1.1
RichTextBox will automatically (... more)
|
Installing Richer Components Controls in Visual Studio .NET
To see the “bin” folder in Visual Studio .NET you will have to select the “Show All Files” option in the Solution Explorer. Drag the appropriate DLL (RichTextBox.dll for example) and the XML file into the bin folder and it will automatically add a reference to the assembly for you. Alternatively you may add the control to the Web Form's Toolbox (3. below) in which case the drop and drag of the control onto your .aspx page creates the appropriate DLL reference.
Drag the Images folder into (... more)
|
Installing Richer Components Controls in the Global Assembly Cache
First, open a command prompt and browse to the appropriate .dll file. Type the following command (this example is for RichTextBox so substitute this for the appropriate control in your case).
gacutil.exe -i richtextbox.dll
Or if gacutil.exe is not available globally then browse to it’s installation folder at –
C:\program files\Microsoft VisualStudio .NET\FrameworkSDK\bin\gacutil.exe
or C:\program files\Microsoft Visual Studio .NET (... more)
|
Adding Richer Components Controls to the Matrix toolbox
To add Richer Components Controls to the toolbox:
Right-click on the toolbox and select "Add local toolbox components".
Click Browse and browse to the location of the appropriate DLL file.
Click Open.
The control will be added to the toolbox. You can then drag-and-drop it onto pages in design-view. You can also edit control properties using the property sheet.
(... more)
|
HTML and BODY tags are removed / disappear ?
My and tags dissapear when I re-enter in HTML mode.
This is Internet Explorer behaviour and can not be avoided in the control. The workaround is to re-apply these tags on postback.
(... more)
|
Activating inserted hyperlink in WYSIWYG.
You can use javascript like the following to make a link active in RTB WYSIWYG mode just like a button etc.
Note: Please add the sample script to the end of .aspx page containing RichTextBox – like put the script after the tag but before the tag
Be sure to add _x5 to the ID of RichTextBox as this refers to the RichTextBox IFrame element.
function modifySelected()
{
(... more)
|
Image Insert Causes Browser to Crash
In some instances it’s been found that running javascript code like the following to insert image elements in the RichTextBox editor/Iframe can cause the Browser to crash with a fatal error.
http://localhost/images/Imagegally/testimage.jpg;
rtb.document.execCommand('InsertImage','',"+sImage+");
It’s been found that setting SmartNavigation = false for the containing page prevents this problem as having it set to true causes a conflict with the code above.
(... more)
|
RichTextBox Text/Content Lost on Postback
The RichTextBox maintains its state in a hidden control and there's a client side function that must be called in order to do this. In certain cases when a postback is caused by another element on the page the appropriate events are not fired so the function doesn't get called on the postback to the server.
If you’re experiencing this problem, then you should add the onclick event to the control causing the postback and add the appropriate javascript function –
In (... more)
|
Using the ASP Regular Expression Validator for RichTextBox Content
If you use an ASP Required Field Validator to validate RichTextBox content you may find that it validates even when there is no text displayed in the editor. This is due to HTML fomatting tags being used to validate even when there are no text elements within the tags. For example the following will validate fine with the Required Field Validator -
(... more)
|
Pasting Javascript into the RichTextBox Editor
The following behaviour appears to be an IE quirk as the RichTextBox editor is simply an IFrame element.
In HTML mode if you clear all content and then paste in javascript it will disappear from the editor document even though it still exists in the document content on postback.
If you type some text in the editor and then copy the javascript in Html mode after the text or if you leave the created by the editor and paste under this in Html mode then it ret (... more)
|
Crystal Reports with RichTextBox
If you wish to use Crystal Reports as a reporting tool with RichTextBox you should use Crystal Reports Version 10.0 because HTML text interpretation is not supported in Version 9.x
(... more)
|
Client Side Disabling of the RichTextBox editor and Toolbar Items
Firstly an example of disabling the Editor and moving focus to another element. If you don’t move the focus from the editor, it will appear disabled (greyed out) but the user can still type content.
WebForm1 (... more)
|
Show the Spell Checker from a Shortcut Key Event
To do this you'll need to add some client script to your page that calls the appropriate method when your short cut keys are pressed.
The Javascript method call to show the spell check dialog is below -
RTB_SpellCheck(RichTextBox1_x5, RTB_HtmlMode_RichTextBox1())
My RichTextBox client id is RichTextBox1 in this case. If it were different then the prefixes above would need to be different.
So for example to call this method when Ctrl + S are (... more)
|
Setting the Location of RichTextBox Dialogs
The current default location for RichTextBox dialogs like spellchecker and insert link is the centre of the screen and they can’t be moved by the user. If you which to set the location of these to a different screen location then do so by defining a CSS style rule and applying it to your .aspx page.
To do this I've applied a stylesheet to my .aspx page using -
link rel="stylesheet" type="text/css" href="StyleSheet1.css"
Then in this sheet I have defined a CSS (... more)
|
Reading and writing files to and from RTB
In order to write the contents of a file to a RichTextBox control or write the content of a RichTextBox control to a file, all you need is something like this:
more)
|
How do I set focus to the items in my form?
It is often useful to ensure that the focus is set to the first item in a web form. RichTextBox currently takes focus when it appears on a page, but if you want another form element to take focus (usually the first) you can do it like this:
document.forms[0].elements[0].focus();
Note that some form elements (e.g. checkboxes) will not look as if they take focus, when in fact they do.
To set focus to a specific item, do this:
|