About
I am a Senior Software Engineer in Hyderabad, India. I worked on .NET 1.0, 1.1, 2.0 and recently got a chance to work on .NET 3.0 & 3.5 as well. When I saw so much to learn in all these versions, I decided to start a blog to keep all my learning at one place for me and you to refer easily.
As and when I will get time and come across a new things I will keep updating this blog.
Thank you for visiting my blog.



i have a textbox and i have limited its maximum length to be 300 words.I want to add a feature that when some one type a word a label should show that how many characters are left to type in. This has to be implemented in ASP.NET.
I u can help plz let me know at sanjeevp14@yahoo.co.in
rajendra Parmanik
August 25, 2008
Hey! Rajendra,
You need to use simple javascript in this case instead of going for a .NET solution. The Textbox and label mark up is here:
[asp:Label ID="Label2" runat="server" Text="Label"] [/asp:Label]
[asp:TextBox ID="TextBox1" onkeyup="Count()" runat="server"] [/asp:TextBox]
The corresponding javascript function is Count() as follows:
[script language="javascript" type="text/javascript"]
function Count()
{
var txtBox = document.getElementById(‘TextBox1′);
var lbl = document.getElementById(‘Label2′);
//alert(txtBox.value);
lbl.innerText = txtBox.value.length;
}
[/script]
(Pls replace [ with )
Just put the above script in the section in your asp.net page.
Thank you,
sunworld
August 25, 2008