I did this a couple of times.
Miro Mašat

I think the fact this is offensive is because you are basically telling a female what to do(which is to smile). If you are interested in a girl and wanna chat up with her, just do or say something that would make her smile by herself.