Try this one. It will Disable your Space bar on appropriate textbox:
Use this Javascipt Function on client side code.By this you can You can stop Space to be entered:
function CheckNemericValue()
{
if(event.keyCode == 32)
{
event.keyCode = 0;
return false;
}
}
and then on page_load event use this ;
TextBox1.Attributes.Add("onkeypress", "return CheckNemericValue(event);")
But Beware! it will not work on that text which copied and paste into this textbox.
For this problem use this code:
<asp:TextBox ID="TextBox1" runat="server" onblur="javascript:value=value.replace(/\s/g,'');"></asp:TextBox>