I am new to C#/ASP.NET so im not quite sure how to go about doing this. I am building a website which allows users to upload documents in .pdf, .html or .txt. I then take the uploaded file, convert .pdf and .html files to .txt and send the files to a database. When the user clicks on the database, they will be presented with the titles of each document and when the click the document they want, another window opens up and displays the content of the document as a text.
My question is the following: if i wanted to implement a feature where the user clicks a button called "highlight", the user will then be expected to select the text they want to highlight and change the background of that text to some other color, i.e yellow. How would i go about doing this?
I have searched the internet but i can't quite seem to get results for what im looking for. The results i keep getting are for selecting the whole textbox and changing the background color. What i need to do is be able to select multiple intervals anywhere on my text to change the background of that specific text, to give the impression that the text has been highlighted with a highlighter. Exactly the way bytes.com does it when a user asks a question, in the "Give us more details... (required) section, the last bullet is
- For programmers: place all code in [ CODE ] . . . [ /CODE ] tags
Where everything from the word "place all code... tags" has a green background. I need that, being controlled by a button called "highlighting" Any ideas?
here is the code snippet of where i load the file from the DB, in case that helps:
Expand|Select|Wrap|Line Numbers
- NSTFile file = ComplianceMapper.FindComplianceDocumentByName(fileName);
- StreamReader tr = new StreamReader(new MemoryStream(file.ByteContent));
- TextBox1.Text = tr.ReadToEnd();
- tr.Close();