RadControls version | 2008.3 1314 |
.NET version | 2.0 / 3.5 |
Visual Studio version | 2008 |
programming language | asp.net / Javascript |
browser support | all browsers supported by RadControls |
PROJECT DESCRIPTIONI wanted to have an easy way to add and edit anchors. In my case i used the Editor as my default editor in DotNetNuke 5.0 but i think this solution is for other configurations to.
I used 2 different example codes that i have merged for my solution. So its maybe nothing new but hopefully it is useful.
First step is showing the anchors in the editor. Therefor i added a OnClientLoad event to my radEditor. In DotNetNuke you can do this in the web.config. OnClientLoad="OnRadEditorLoad"
On the page where my Editor is loaded i added this javascript.
The script adds a class name to all html anchors. In my case i added the className "radAnchor"
In DotNetNuke you can add this script in your skin. I made a admin skin so that the script is only applied on the admin pages.
Use css to style the anchor in the design view. I used a custom css file for my Editor.
Now you should see the anchors in the editor. U can use the Link Manager Dialog to add a anchor to the page. But because this isn't user friendly i wanted to have a custom button that shows a dialog to add and edit the anchor.
So this is the second step. Adding a Custom Dialog to add and edit anchors.
I've created a aspx file that is the content of the "Insert anchor" dialog.
This file (InsertAnchor.aspx) is located in the folder of your editor. In my case this is /DesktopModules/TelerikWebUI/RadEditorProvider.
Next step is adding a custom button in the toolbar. I use the ToolsFile.xml so i added this line of code:
Now we need to connect the new button to the Custom Dialog. This by adding some javascript. You can add this at the same place as the script to show the anchors.
So besides skinning the button, it should work now.
To skin the button add this peace of code to your css file.
Kind regards,
Dieter