Telerik blogs

When asking the user to provide input in any application it can help to give them guidance on what you are expecting.  There are a variety of ways to accomplish this, but one in particular seems to be very effective.  If you have ever used Microsoft PowerPoint you will undoubtedly have seen a screen similar to the graphic below.

image

The instructional prompt effectively conveys to the user where to type a title and subtitle for the slide.  Better yet, the user can ignore these prompts and proceed with other activities in the application.  Live Search Map provides another example of using instructional prompts to tell the user additional information about what can be searched, see below.

image 

You might be interested to know that you can implement this in your applications if you are using the RadControls for WinForms.  This is accomplished by using the NullText property on the controls. 

string firstName = "John";  
string lastName = null;  
firstNameEditor.Text = firstName;  
firstNameEditor.NullText = "What is the person's first name?";  
lastNameEditor.Text = lastName;  
lastNameEditor.NullText = "What is the person's last name?"

image

So as you can see when the value of the control is null the NullText is displayed, otherwise the appropriate value is displayed.  This can be extremely helpful to the user and many times the user will notice this text before a label beside the control.  You could use it in the RadComboBox to ask the user to "Select an city" without that option being in the list so no coding necessary to handle it.  You could even convey more about the mask being used in your RadMaskedEditBox.  I do want to highlight the fact that this can be used with the RadDateTimePicker, but it is slightly different. You cannot assign a null value to the RadDateTimePicker because it is a DateTime value type.  So another property called NullDate can be used to identify a date like "01/01/1900" to be recognized as an indicator to display the NullText property.  Yes, you have to sacrifice the "01/01/1900" or whatever date you select, but it is probably worth the trade off.

DateTime? birthDate = null//nullable DateTime  
dateOfBirth.Value = birthDate.GetValueOrDefault(new DateTime(1900, 01, 01));  
dateOfBirth.NullDate = new DateTime(1900, 01, 01);  
dateOfBirth.NullText = "When where you born?";  

image

There you go, you can really enhance an interface by using techniques like this to guide the user.  One side note, if you are using the RadDateTimePicker you might want to consider using a date other than "01/01/1900" because if the user clicks the dropdown they will be starting in the year 1900.  In most cases, you can assign the NullDate in code to DateTime.Today.AddDays(1) so the user starts at a time more reasonable when they click the drop down calendar.


About the Author

Nikolay Diyanov

Diyanov is the Product Manager of the Native Mobile UI division at Progress. Delivering outstanding solutions that make developers' lives easier is his passion and the biggest reward in his work. In his spare time, Nikolay enjoys travelling around the world, hiking, sun-bathing and kite-surfing.

Find him on Twitter @n_diyanov or on LinkedIn.

Comments

Comments are disabled in preview mode.