Solved

URGENT c# Web Text Box

Posted on 2003-11-17
3
341 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

737 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