Archive for 'ASP.NET'

GoogleMap License to share

About SubGurim Google Map control

GoogleMaps.Subgurim.NET is the most advanced Google Maps control for ASP.NET 2.0. With the full power of the official GoogleMaps API, yet without the need of a single line of javascript code: only ASP.NET!

Just drag the control in Visual Studio, and with a few lines of code you will be able program powerful Google Maps applications!!

Well, I’ve been rewarded 100 license of Subgurim’s GoogleMap control for translating the website to Indonesian and I’m about to share 20 of them for FREE ! (FYI, each license is worth 10 EURO).

The rules

  1. You can use the license for personal or even commercial purposes.
  2. One email address can only request one license for a single domain.
  3. Please leave a comment with valid email, URL and a short description of your website (the license will be sent by email later).
  4. Valid for the first 20 requester.

note. The license will be created in the subgurims’s website so it’s valid and legal.

Konversi dataset ke JSON

Setelah muter2 ketemu juga akhirnya. Biar gampangnya, serialisasi ke JSON menggunakan library JSON.NET, di websitenya ada beberapa versi tergantung versi .net framework yang digunakan. BTW, ini kodenya :

   1: Imports Newtonsoft.Json

   2: Private Function GetCustomer() As String

   3:     Dim retVal As String = ""

   4:     Dim ds As DataSet = DAL.Customer.GetCustomers

   5:

   6:     If ds IsNot Nothing AndAlso ds.Tables(0).Rows.Count > 0 Then

   7:         Dim custList As New List(Of Hashtable)()

   8:         For i As Integer = 0 To ds.Tables(0).Rows.Count - 1

   9:             Dim ht As New Hashtable()

  10:             Dim row As DataRow = TryCast(ds.Tables(0).Rows(i), DataRow)

  11:             ht("IDCustomer") = Convert.ToString(row("IDCustomer"))

  12:             ht("CustomerName") = Convert.ToString(row("CustomerName"))

  13:             custList.Add(ht)

  14:         Next

  15:         retVal = JavaScriptConvert.SerializeObject(custList)

  16:     End If

  17:

  18:     Return retVal

  19: End Function

Output yang dihasilkan adalah sebagai berikut (setelah dirapikan):

   1: [

   2: {"IDCustomer":"1","CustomerName":"Unyil"},

   3: {"IDCustomer":"2","CustomerName":"Cuplis"},

   4: {"IDCustomer":"3","CustomerName":"Ableh"}

   5: ]