Skip to main content

Posts

Showing posts with the label Client Scripting

C#: Geocoding to get Latitude and Longitude using Google Maps API

Geocoding is the process of getting the latitude and longitude of an address or set of addresses, which you can use to place markers or position the map. Geocoding can be done on the client-side as well as on the server-side, based on your requirements you need to choose one out of both options. For geocoding I am using Google Maps API which is quite reliable and faster in response to other geocoding APIs. You can check the JSON response by directly running the API with the address on the browser window or you can take service of POSTMAN as well. Sample JSON response of Google Map API is given below: Requested geocoding of "Gurgaon" using Google Maps API Request: http://maps.googleapis.com/maps/api/geocode/json?sensor=true&address=Gurgaon Response: {     "results" : [        {            "address_components" : [          ...

Knockoutjs check/uncheck all checkboxes using header checkbox.

While working with Knockoutjs ViewModel, if we implement the select all checkbox feature using traditional JavaScript/JQuery, then in such scenario we can see that Knockoutjs observable property is not getting updated when all checkboxes are checked/unchecked. To handle such situation, we can create Knockoutjs computed property ( with read/write ) and can bind it to header checkbox and there is no need to use the traditional JQuery. Below is the sample code to demonstrate the same: As usual create the Knockoutjs ViewModel and then bind it to UI using ko.applyBindings function CheckViewModel() {     var self = this ;     self.Countries = ko.observableArray(                                                 ...