Solved

URGENT c# Web Text Box

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

786 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