Retrieve selected text from RIchTextBox control
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngrichtextbox' list.


Anand Rajagopal - CTD, Chennai.
I am using a RichTextBox control in my application. I want to retrieve the
text that has been selected(highlighted) inside the RTB control by the user.
The reason i want to do this is to add html tags of changing the background
color of the selected text alone. I tried using javascript,
selection.createrange() , but it is not returning the selected text inside
the RTB control. Instead it is able to retrieve the text selected in the
body. Please help.
My application is in ASP.NET with C#

Reply to this message...
 
    
Ollie Cornes

Hi Anand,

The document is stored inside an iframe tag. To access the HTML and get
a text range, use the members of that tag. To find the tag name take the
name of your RichTextBox and add "_x5" to the end. So, for example, if
your RichTextBox is called RTB1, there will be an <iframe id='RTB1_x5'
...></iframe> in the page.

Does that answer your question?

Ollie
--
http://www.richtextbox.com/
The no. 1 content editor for ASP.NET

[Original message clipped]

Reply to this message...
 
 
System.Windows.Forms.RichTextBox




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com