Solved

URGENT c# Web Text Box

Posted on 2003-11-17
3
334 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now