Question: I want to prevent a user from entering blank spaces into a username textbox.I would be very grateful to the person,if anyone answered

Answer: 
Use Javascript code as below:

```
<input type="text" name="myText" onKeypress="if (event.keyCode == 32) event.returnValue = false;"/>

```

tested in `Internet Explorer`
You can also use `FilteredTextBoxExtender` control from `AjaxControlToolkit`. It will ease your application's maintenance if you need to change or add other forbidden characters some day. 

> 
> See example here: [FilteredTextBox Sample](http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/FilteredTextBox/FilteredTextBox.aspx)
> 
> 
>