0

I have a web app in which I want to be able to highlight a word or two in a multi-line textbox, out of several paragraphs of text, and have a button click method manipulate the selected text. I want to be able to store the selected text in a variable but I haven't been able to find a way to get highlighted text in System.Web. I know that System.Windows textboxes have the SelectedText property which would be perfect, but unfortunately I don't know how to use anything but the asp.net framework with html pages and c# code behind.

Basically what I am after is an equivalent of TextBox.SelectedText that I can use in a web app, or an alternate route which will accomplish the same result.

The user will be writing the content into the textbox so suggested different controls need to be editable. I have tried incorporating Javascript into my C# code but it proved too complicated for me, and I don't know how to create a solely javascript web app.

Thank you for your answers so far

  • Possible duplicate of [How to get selected text from textbox control with javascript](http://stackoverflow.com/questions/275761/how-to-get-selected-text-from-textbox-control-with-javascript) – DanielS Oct 24 '15 at 02:06
  • [`textbox.SelectedText`](https://msdn.microsoft.com/en-us/library/system.windows.controls.textbox.selectedtext(v=vs.110).aspx) – Ben Oct 24 '15 at 02:09
  • Not a duplicate, as I am using solely C# – Michael O'Hara Oct 25 '15 at 05:20

0 Answers0