By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,087 Members | 1,508 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,087 IT Pros & Developers. It's quick & easy.

Is This Even Possible?

P: n/a
In a C#/code-behind ASP.NET application, I want to enable the user to view a
few paragraphs. I want to enable the user to select a sentence (or an
individual word) within the paragraph. By *select* I mean that the user
clicks and drags over the word(s) to be selected - just like in any other
application that allows the user to select text. After selecting the desired
text, I want to enable the users to click a button - at which point some
code runs that ultimately results in the selected text (and not any of the
unselected text) being saved to a database.

I can do practically all of this. The part I'm hung up on is
programmatically determining which text the user selected within the
paragraph. Is that even possibe? If so, how?

Thanks in advance.
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
David Krussow wrote:
In a C#/code-behind ASP.NET application, I want to enable the user to
view a few paragraphs. I want to enable the user to select a sentence
(or an individual word) within the paragraph. By *select* I mean that
the user clicks and drags over the word(s) to be selected - just like
in any other application that allows the user to select text. After
selecting the desired text, I want to enable the users to click a
button - at which point some code runs that ultimately results in the
selected text (and not any of the unselected text) being saved to a
database.

I can do practically all of this. The part I'm hung up on is
programmatically determining which text the user selected within the
paragraph. Is that even possibe? If so, how?

Thanks in advance.


It's possible if you use Javascript + populating hidden fields that you
access on postback. I can't tell you what kind of Javascript event handling
you would need to detect the begin/end selection points. But that's the
solution I believe.
Nov 18 '05 #2

P: n/a
Do you have the options of Java or ActiveX? I think that's the only way to
get the selected text. I don't know of any javascript that will give you
the selected text in a textbox or outside of a text box.

http://www.javascripts.com might have a javascript solution.

Michael

"Alex" <aa******@hotmail.com> wrote in message
news:40********@news.microsoft.com...
David Krussow wrote:
In a C#/code-behind ASP.NET application, I want to enable the user to
view a few paragraphs. I want to enable the user to select a sentence
(or an individual word) within the paragraph. By *select* I mean that
the user clicks and drags over the word(s) to be selected - just like
in any other application that allows the user to select text. After
selecting the desired text, I want to enable the users to click a
button - at which point some code runs that ultimately results in the
selected text (and not any of the unselected text) being saved to a
database.

I can do practically all of this. The part I'm hung up on is
programmatically determining which text the user selected within the
paragraph. Is that even possibe? If so, how?

Thanks in advance.
It's possible if you use Javascript + populating hidden fields that you
access on postback. I can't tell you what kind of Javascript event

handling you would need to detect the begin/end selection points. But that's the
solution I believe.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date: 1/27/2004
Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.