If u want to use from javascript u can use this function on blur of textbox
/*Events Fires on blur of TextBox*/
function fnChange()
{
var obj;
obj=document.getElementById('txtName'); //get the context of txtName element
if (obj!=null)
{
if (Number(obj.value.length)<9)
{
Val=obj.value.toString(); //converts to string
Val= '000000000' + Val ; //append 9 0's to the string
obj.value=Val.substr(obj.value.length,Val.length); //gets the substring of Val.
//like right function right(String,startindex)
}
}
}
if u want this should happen on post back u can use this
txtRefNum.Text = Format(Val(txtRefNum.Text), "0########")
"TN Bella" wrote:
I have a simple text box called txtrefnum, if the user enters a number
length less than 9 characters long than I need to have lead zeros
added to it. Does anyone know how to do this? I couldn't find anything
online on the subject...
<asp:TextBox id="txtRefNum" runat="server"></asp:TextBox>
I thought I could use a validator for the process and make the user
add the zeros, but of course that is a big no-no! Please help!!
Thanks!
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!