Introduction
This code drop is part of a smash and grab series. If you're in a rush, you can just grab this code and insert it into your application, no understanding is required. When you have some time (ya, right), you may want to review the source code.
Background
I recently needed to enter latitude and longitude information into a GridView
control, and so I wrote this ASP.NET 2.0 server control. The top part of the graphic shows the various input formats which you can toggle between using the spinners to the right. The bottom part shows the control in use in a FormView
.
Using the code
- Download the project, unzip it to somewhere on your hard disk.
- Create a new ASP.NET project.
- Create a Bin folder for the project.
- Select Tools > Choose toolbox items.
- Navigate to the unzip folder and select the DLL.
- This new server control now appears in the toolbox (usually) under General.
- Drag an instance of it onto Default.aspx.
- Enjoy.
The control supports these properties:
Points of Interest
You must bind the Text
property of the control to a floating point database type. You will also notice that there is no JavaScript or images that you need to add to your project. These are all imbedded in the DLL using WebResources. I have written an article on using WebResources, here at CodeProject. Search using the keywords redux WebResourse.
Conclusions
There you go, a free ASP.NET 2.0 Latitude/Longitude control that suits my needs and hopefully yours.
SmashGrab / Redux series
I have recently started two series of articles here at CodeProject. Smash&Grab is intended as a series of short articles on one specific code technique. Redux is intended as a series of longer articles which attempt to reduce a complicated topic (like GridView
) into its basic constituent parts and show that once you have all the information, it wasn't really that hard after all. To find the Smash&Grab articles, search for the keyword SmashGrab. To find the Redux articles, search for keyword Redux. I welcome any contributions to either series, but please follow the guidelines when submitting articles to either.