Click here to Skip to main content
16,023,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I need to get a cursor location in a asp textbox content.
Please give me your suggestions.

Thanks,
Posted

Try myTextBox.SelectionStart . You should get where the caret is

[EDIT]

I've just realized you were talking about asp.net. I think you should use javascript for that, refer this How to get selected text from textbox control with javascript
 
Share this answer
 
v2
You can use the property SelectionStart of the TextBox Control. Note that whether the text is selected or not you can use this property to find the position of the cursor.

Full details about this method available here[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900