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

Recommended Answers

All 3 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.