hi
iam giving a value in text box as " 2010 - 1 " insted of 2010-1
it shows error,
please give me the code to avoid blank spaces within a string as given above,
iam using asp.net with vb.net
please help me.......

>please give me the code to avoid blank spaces within a string as given above
>iam using asp.net with vb.net

Use JavaScript. Handle the keypress event of textbox.

eg,

...
  <head>
     <script type="text/javascript">
           function dothis() {
               var t=window.event.keyCode;
               if(t==32) // space
                   window.event.keyCode=0; 
          }
    </script>
  </head>
  ...
  ...
 <asp:TextBox id="TextBox1" Runat="server" onkeypress="dothis();" />

Hi..

I had same problem ..thanks for help me for giving me this code.