If you want to write a value where spaces are not a valid character, you can use RegularExpressionValidator :
<asp:RegularExpressionValidator ID="rev" runat="server" ControlToValidate="txtBox"
ErrorMessage="Spaces are not allowed!" ValidationExpression="[^\s]+" />
<asp:RequiredFieldValidator ID="rfv" runat="server" ControlToValidate="txtBox"
ErrorMessage="Value can't be empty" />
"hello world" " ", , "helloworld" "database" . RequiredFieldValidator , , RegularExpressionValidator .
ControlToValidate.