Skip to content

Instantly share code, notes, and snippets.

@akorchev
Created January 31, 2012 08:49
Show Gist options
  • Save akorchev/1709515 to your computer and use it in GitHub Desktop.
Save akorchev/1709515 to your computer and use it in GitHub Desktop.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.litSalesGridDataSource.Text = "<script>" & vbCrLf & _
"var oSales = [" & vbCrLf
For i As Int32 = 1 To 5
Select Case i
Case Is = 1
Me.litSalesGridDataSource.Text &= "{" & vbCrLf & _
"""SaleID"": """ & i & """," & vbCrLf & _
"""SaleDate"": """ & Format(CDate("01-Jan-2012"), "MM/dd/yyyy") & """," & vbCrLf & _
"""Total"": " & FormatNumber(i, 2, TriState.UseDefault, TriState.UseDefault, TriState.False) & vbCrLf & _
"}," & vbCrLf
Case Is = 2
Me.litSalesGridDataSource.Text &= "{" & vbCrLf & _
"""SaleID"": """ & i & """," & vbCrLf & _
"""SaleDate"": """ & Format(CDate("30-Jan-2012"), "MM/dd/yyyy") & """," & vbCrLf & _
"""Total"": " & FormatNumber(i, 2, TriState.UseDefault, TriState.UseDefault, TriState.False) & vbCrLf & _
"}," & vbCrLf
Case Is = 3
Me.litSalesGridDataSource.Text &= "{" & vbCrLf & _
"""SaleID"": """ & i & """," & vbCrLf & _
"""SaleDate"": """ & Format(CDate("01-Feb-2009"), "MM/dd/yyyy") & """," & vbCrLf & _
"""Total"": " & FormatNumber(i, 2, TriState.UseDefault, TriState.UseDefault, TriState.False) & vbCrLf & _
"}," & vbCrLf
Case Is = 4
Me.litSalesGridDataSource.Text &= "{" & vbCrLf & _
"""SaleID"": """ & i & """," & vbCrLf & _
"""SaleDate"": """ & Format(CDate("01-Feb-2012"), "MM/dd/yyyy") & """," & vbCrLf & _
"""Total"": " & FormatNumber(i, 2, TriState.UseDefault, TriState.UseDefault, TriState.False) & vbCrLf & _
"}," & vbCrLf
Case Else
Me.litSalesGridDataSource.Text &= "{" & vbCrLf & _
"""SaleID"": """ & i & """," & vbCrLf & _
"""SaleDate"": """ & Format(CDate("11-Dec-2011"), "MM/dd/yyyy") & """," & vbCrLf & _
"""Total"": " & FormatNumber(i, 2, TriState.UseDefault, TriState.UseDefault, TriState.False) & vbCrLf & _
"}" & vbCrLf
End Select
Next
Me.litSalesGridDataSource.Text &= "];" & vbCrLf & _
"</script>" & vbCrLf
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment