Character count in textbox

S

si_owen

Hi Folks,

I am trying to set up some code that will provide a character count
for the text entered into a textbox on my form. I am coding in VB.Net
using visual studio 2003 - web appliaction.

I have sorted the VB code, which when execute via a command button it
updates the label.

Private Sub txtcomment_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TextBox1.TextChanged

Label1.Text = TextBox1.MaxLength - TextBox1.Text.Length
End Sub

I want to run this code dynamically so that the update happens in rel
time, however I cant seem to get any compatable Javascript that works
with text changed.

Does anyone have any ideas??

Thanks in advance,

Simon
 
H

Hal Rosser

si_owen said:
Hi Folks,

I am trying to set up some code that will provide a character count
for the text entered into a textbox on my form. I am coding in VB.Net
using visual studio 2003 - web appliaction.

I have sorted the VB code, which when execute via a command button it
updates the label.

Private Sub txtcomment_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles TextBox1.TextChanged

Label1.Text = TextBox1.MaxLength - TextBox1.Text.Length
End Sub

I want to run this code dynamically so that the update happens in rel
time, however I cant seem to get any compatable Javascript that works
with text changed.

Does anyone have any ideas??

To be dynamic, you should use javascript instead of making a trip to the
server every time something grunts.
 

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

Top