I got an e-mail yesterday from someone asking me this:
I have read one of your answers to a problem someone was having and you suggested to add a – Select – in the drop down list.
I had already done that, but how do I do the validator to check that this – Select – is not still there.
I think what she means is: “how do I add a validator to my ASP.NET web application to make sure that the user has not left a drop down list at the default option (“Select one” or whatever)?”
The answer is: use a
RequiredFieldValidator control. Set its
InitialValue property to the value of the default option in the list, that you don’t want your users to choose, and the
ControlToValidate property to the ID of the drop down list.
But that is not the point of this blog entry.
I get questions like this every so often from people who have read something that I have written on some forum system or other. If you are good with computers and active in an online community, it goes with the territory, I guess. People see that you know your stuff and come directly to you for advice.
This is usually not the best idea. It is far better to post your question on a public forum where everyone can see it and have a stab at giving you an answer. There are several reasons for this.
First, someone else may be asking the same question as you and could also benefit from the answer.
Second, you are likely to get an answer much more quickly that way. On active developers’ forums, there are always hundreds of people online at any one time ready and able to answer your question straight away. On the other hand, we developers often have to prioritise, and questions from strangers asking for free advice tend to get pushed down to the bottom of the pile when we are busy.
Third, I might not be the best person to answer your question in the first place. There may be other people who know more about what you are asking than I do, or it may be the kind of question that requires some discussion in order to be resolved and clear up some misunderstandings.
Finally, I simply may not have time to answer your question. I may be facing a tight deadline, or on a camping holiday and offline for the week. As a rule, we developers only contribute to forums when we can give an answer off the tops of our heads. Time doing research and/or looking things up tends to be reserved for our paying clients, our day jobs, and our own projects.
I’m not writing this to whine, or to get at anybody, but to point people in the right direction. By participating in online communities such as forums, a lot of people can benefit who would not otherwise if it were just a private conversation between you and me.