Solved

URGENT c# Web Text Box

Posted on 2003-11-17
3
340 Views
Last Modified: 2006-11-17
Hi i have to create a text box to work on the web which will allow the user to Edit Text Files used as web content,

How do i get the following working

After a user has Selected a section of text from the text box and pressed the bold tool (which i have used an imagebutton for) how do i get it to do the following.

Wrap the selected text within the html bold tags<b></b>
hide the html tags and display the text as bold within the textBox

Once the user has finished altering the text within the TextBox they save the Text back to the file with the html Tags in the correct place.

CAN SOMEONE URGENTLY HELP
Regards
Chris Robinson
0
Comment
Question by:chris_shadow
3 Comments
 
LVL 7

Expert Comment

by:jj819430
ID: 9766590
I am not sure, but I would pray there is a "Selected" value for the text box if there is a simple way to do this. Much like a drop down menu. Then you could insert into 1 before and 1 after the textbox a <B> </B>
I just wanted to give you a quick response of somekind to help you on your way. Hopefully someone has a better solution.
0
 
LVL 4

Accepted Solution

by:
astankovic earned 500 total points
ID: 9767267
Do you need to do it on the client side or serve side? Is the <b> tag the only one you need to support?
I'm almost certain you can't do it entierly on the server side, so some client side javascript must be used.

If you need to handle more than just <b> tag i would suggest using an already made html editing control. There are a thon of them available ranging from free to very expencive.

One that i used on a recent project is a free RichText Editor control (http://www.exporttechnologies.com/?product=RichTextEditor&version=0.92) I was able to put it in my pages instead of textbox after the fact and it worked flowlesly. I know this sounds like an ad for RichText Editor but i'm not affiliated with them.. just a happy customer.
See the demo at this page: http://www.exporttechnologies.com/softwaredownloads.asp

Anyways, hope this helps.
Alex
0
 

Expert Comment

by:Natasja_
ID: 9770283
You will need a IFrame as the editor.
Then call the DHTML execCommand functions



<IMG onclick="ToBold(editorwindow);" src="images/bold.gif" width="23" unselectable="on">

<IFRAME id="editor" onblur="CloneData();" name="editorwindow" width="100%" height="100%">


function ToBold(editor) {
      TxtFormat(editor,'bold');
}
function TxtFormat(editor,format){
editor.document.execCommand(format,'',null);
}


msdn.microsoft.com/workshop/author/dhtml/ reference/methods/execcommand.asp

0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question