Feature #2: Time or No Time
A web form can contain many fields, some are required and others are made optional. Its easy to check whether users have put any value in a text box or not. We can check the "TextBox.Text" property for empty or null value. Simple. Now if you are using TimePicker to get time information from user, you get the time not in string format but in "System.TimeSpan" structure, which cannot be set to null or empty. If user decides not to enter any value in time field, TimePicker Legacy will set its "SelectedTime" property to "00:00:00" which itself denotes a time (i.e 12:00 AM) . This is not what user inteded, he wanted to leave the value blank. So how to recognize this scenario.
TimePicker Reload provides a solution by defining a special constant value "NoTime". This is essentially a negative time "-01:00:00". Now if user decides not to put any value in time field, SelectedTime will be set to "NoTime" constant. Now there are many many changes that were required to make sure this solution worked. Like, what will user see if no time is selected.? What if some time is already selected and user want to clear it and make it blank?
Best way to tell about this feature is to show you some screens shots :
And here is what happens when you click Time button:That raps up the second feature. Just to add more fun and interactivity I have put up a small poll to get your votes on feature coolness. You will see this poll with every feature I post here. So keep voting and enjoying new features :)
1 Comments:
This particular article was very informative, but i have a question. Is there a way to clear out the time on server side or via javascript?
Post a Comment
<< Home