My requirement is - when user enter any number in the text box & tabout - i need to add leading zero's in the text box value.
function AddPaddingToInvestmentNumber(sender, args)
{
var textBoxVar = "<%=txt1.ClientID %>";
var fValue = $find (textBoxVar).get_value();
var resultset = FormatInvNumber(fValue, 5);
$find(textBoxVar).set_value(resultset);
}
function FormatInvNumber(num, size) {
var s = num + "";
while (s.length < size) s = "0" + s;
return s;
}
code is working fine - but i am not able to set the value in radtextbox OnBlur event
<telerik:RadNumericTextBox ID="txt1"
MaxLength="5" Type="Number" Width ="50"
Font-Size="11px" NumberFormat-DecimalDigits="0"
DataType="System.Int32" runat="server">
<ClientEvents OnBlur="AddPaddingToInvestmentNumber" />
</telerik:RadNumericTextBox>
Try to set the sender -
sender._value = yourvalue;
sender._displayText = yourvalue;
sender._text = yourvalue;
sender._validationText = yourvalue;
sender._textBoxElement.value = yourvalue;