Counting from a textbox, asp.net

How to count characters in a TextBox using ASP.NET (C #)?

+2


a source to share


2 answers


This property to see how long the text is during postback:

TextBox.Text.Length;

      

TextBox: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.aspx



Text Property: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.text.aspx

Line length: http://msdn.microsoft.com/en-us/library/system.string.length.aspx

String str = TextBox.Text;

if(str.Length > 50)
{
   str = str.SubString(0, 50) + "<br/>" + str.SubString(50);
}

      

+8


a source


How to count charachters in a textbox and if nubmers move more than 50 by adding a tag
to charachters?



0


a source







All Articles