Skip to content

Client side functionality with server side values

ruan

Asked Sep 16, 2004, 6:46 AM EDT1 answer
Share
LinkedInX
Hi, I'm developing an SMS based application. Firstly I need to limit the user to 155 characters in a textbox,and secondly, he should see the number of available characters left to type increase/decrease as he types them. I have two HTML textboxes next to one another on a form. The one textbox is read/write and the other read only. User enters a value into the write textbox, and the read texbox must show how many characters are left. This is fairly straight forward javascript; I just used a calculation function that gets called through the onpropertychange event of the texbox. My problem comes in when I try and get the value of the texboxes throug C#. C# does not recognise the texboxes as they are client side, and if I run the controls as server controls, I lose the client side functionality of being able to show the user the character amount without having to do a post back Help?

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    It's no problem to use server controls. The asp:TextBox gets rendered into a textarea with the same ID so you can access it with javascript and calculate the remaining chars.
    0