0

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.......

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by crishjeny
0

>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();" />

Edited by __avd: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.