Connecting Tech Pros Worldwide Help | Site Map

Saving text highlighted anywhere on web page to a C# string

Newbie
 
Join Date: Feb 2007
Posts: 3
#1: Feb 24 '07
Hello Everyone!

I saw a few discussions on saving highlighted text in a text box. I am interested in saving text highlighted anywhere on a web page and to save that text as a string in C#. I know C# fairly well, but I'm a newbie with JavaScript and ASP.NET. If anyone knows a simple elegant way to do this I would really appreciate it, but I'll take any solution at this point. Even if you can point me in the right directions that would be appreciated. Thanks in advance.

Bob
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Feb 26 '07

re: Saving text highlighted anywhere on web page to a C# string


Welcome to The Scripts, Bob.

See this page to get your selection using Javascript. Then store this in a text box or textarea as shown on that page. Then send that form to a page which contains your C#/ASP.NET code. If you need help on that, post in the .NET forum.
Newbie
 
Join Date: Feb 2007
Posts: 3
#3: Mar 4 '07

re: Saving text highlighted anywhere on web page to a C# string


Thanks acoder! Looks like exactly what I was trying to find.

Bob
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: Mar 4 '07

re: Saving text highlighted anywhere on web page to a C# string


You're welcome. Glad I could be of help.
Reply