Hi Poonam,
The simplest and fastest (performance-wise) way is to use the regular expression.
^[a-zA-Z0-9]*$
It matches any alphanumeric string (no spaces).
Description:
^ : start of string
[ : beginning of character group
a-z : any lowercase letter
A-Z : any uppercase letter
0-9 : any digit
] : end of character group
* : zero or more of the given characters
$ : end of string
Regards,
Swatantra