Solved

URGENT c# Web Text Box

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

691 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