// two decimal places
String.Format("{0:0.00}", 324.4567); // "324.46"
String.Format("{0:0.00}", 324.4); // "324.40"
String.Format("{0:0.00}", 324.0); // "324.00"
// maximum two decimal places
String.Format("{0:0.##}", 324.4567); // "324.46"
String.Format("{0:0.##}", 324.4); // "324.4"
String.Format("{0:0.##}", 324.0); // "324"
// at least 2 digits before decimal point
String.Format("{0:00.0}", 324.4567); // "324.5"
String.Format("{0:00.0}", 23.4567); // "23.5"
String.Format("{0:00.0}", 3.4567); // "03.5"
String.Format("{0:00.0}", -3.4567); // "-03.5"
Thursday, October 22, 2009
Thursday, October 8, 2009
Javascript valdation for textbox langth valdation
< script type="text/javascript" language="javascript" >
function checkCharacterLimit(TB)
{
var maxCharacters = 200;
var withinCharacterLimit = true;
var ValidateTB = document.getElementById(TB.id);
var charCode = ( event.which ) ? event.which : event.keyCode;
var bool=(charCode =="8" || charCode =="46");
if (ValidateTB.value.length > maxCharacters && !bool)
{
withinCharacterLimit = false;
}
return withinCharacterLimit;
}
< /script >
in c# code Add following code
txtJobDiscription1.Attributes.Add("onKeyDown", "return checkCharacterLimit(this);");
function checkCharacterLimit(TB)
{
var maxCharacters = 200;
var withinCharacterLimit = true;
var ValidateTB = document.getElementById(TB.id);
var charCode = ( event.which ) ? event.which : event.keyCode;
var bool=(charCode =="8" || charCode =="46");
if (ValidateTB.value.length > maxCharacters && !bool)
{
withinCharacterLimit = false;
}
return withinCharacterLimit;
}
< /script >
in c# code Add following code
txtJobDiscription1.Attributes.Add("onKeyDown", "return checkCharacterLimit(this);");
Subscribe to:
Posts (Atom)