Determine user-selected text

J

Jeff S

I would like to provide users with a text box in which they can enter a
bunch of text (200 bytes or so). I would like to subsequently
programmatically determine which text the user has selected.

How can the user selection (selected text) be determined during a postback?
How about on the client side? Can it be determined without having to first
post back? I need to understand both ways.

Thanks.
 
G

Guest

Hi Jeff,

If you need to send the text to the server for processing, you can do the following.

From the client side, you can insert any text into a hidden serverside text control (TextBox1) with document.all.TextBox1.value = "some selected string". On the serverside, check for Page.IsPostBack == true and get the value from TextBox1.Text.

Hope this helps,
Thomas

DISCLAIMER: This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top