ACP
ACP

Reputation: 35268

Get number of character selected in a multiline textbox in asp.net

Hai Guys,
I have a multiline textbox and I have set MaxLength="160" ,also i have a label indicating number of characters remaining.... Now i want to get the number of characters selected by the user he may delete it and i have to add to the count representing total number of characters left inside that label..... I want this to be done in the Text_Changed event of the textbox

Upvotes: 0

Views: 844

Answers (1)

slugster
slugster

Reputation: 49974

To do this client side use javascript, a solution for that is shown here. To do it in a server side event handler, just get the length of the string, by the time your page has been posted back to the server the highlight has gone.

Upvotes: 1

Related Questions