Character count in textbox

  • Thread starter Thread starter si_owen
  • Start date Start date
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
 
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.
 
Back
Top