views:

26

answers:

1

This is for a multiline textbox on an asp.net site. I can use either a html control or a an asp.net control but what I want to do is somehow recognize which line is being clicked - preferably server-side so that it works without javascript but a jquery solution would be fine as well. After the line is clicked I need to take the text from said line, and return an output after a xml lookup.

I'm just wondering if this is at all possible or if should just think of a better way to present my data.

Thank you.

+1  A: 

If you don't need to edit the data on the client side, and want to use an ASP.NET component, why not just use a list box?

You can parse your text line by line on the back end, add appropriate spacing if nessissary, and add the items to a listbox.

You can respond to the click event on the post back and identify the line clicked by grabbing the selected item and doing whatever processing you need to do on the back end.

Aside from diving into Javascript, your options are pretty limited.

George
I also want people to be able to copy the entire contents of the textbox, otherwise I'd have gone for a listbox right away..
Radu
Well you didn't say that! ;)
George
So basically I've got to rethink it?
Radu
Is it possible to allow users to copy the entire contents of a listbox using a button?
Radu
Yes, with javascript.
George
If you're trying to stick only with ASP.NET components, your other option would be to display your clickable list and a second selectable text box. Perhaps you could put a tab control on your page, one for selecting the entirety of the text, the other for responding to your events.
George
Thanks for the help!
Radu