Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can't just use the JsonSerializer on your objects - as you can see, it's not the correct format that FullCalendar requires.</p> <p>You will need to provide your own serializer (converted from c#):</p> <pre><code>Public Class Meeting     Public ID As Integer     Public Title As Integer     Public Start As DateTime     Public [End] As DateTime     Public AllDay As Boolean End Class Public Class MeetingJavaScriptConverter     Inherits JavaScriptConverter     Private Shared ReadOnly _supportedTypes As Type() = New Type(-1) {GetType(Meeting)}         Public Overloads Overrides ReadOnly Property SupportedTypes() As IEnumerable(Of Type)         Get             Return _supportedTypes         End Get     End Property         Public Overloads Overrides Function Serialize(ByVal obj As Object, ByVal serializer As JavaScriptSerializer) As IDictionary(Of String, Object)         Dim meeting = TryCast(obj, Meeting)         If meeting IsNot Nothing Then             Dim dictionary = New Dictionary(Of String, Object)()                         dictionary.Add("id", meeting.ID)             dictionary.Add("title", meeting.Title)             dictionary.Add("start", meeting.Start.ToJson())             dictionary.Add("end", meeting.[End].ToJson())                         dictionary.Add("allDay", If(meeting.AllDay, "true", "false"))                         Return dictionary         End If         Return New Dictionary(Of String, Object)()     End Function         Public Overloads Overrides Function Deserialize(ByVal dictionary As IDictionary(Of String, Object), ByVal type As Type, ByVal serializer As JavaScriptSerializer) As Object         Throw New NotImplementedException()     End Function End Class Public Module DateTimeExtensionMethods     Private Sub New()     End Sub     &lt;System.Runtime.CompilerServices.Extension&gt; _     Public Function ToJson(ByVal dateTime As DateTime) As String         Return dateTime.ToString("s")     End Function End Module </code></pre> <p>You can then use it as follows, once you have populated your <code>Meeting</code> list from the query:</p> <pre><code>Dim serializer As New JavaScriptSerializer() serializer.RegisterConverters(New () {New MeetingJavaScriptConverter()}) Dim jsonresult As String = serializer.Serialize(meetings.ToArray()) </code></pre> <p>(Converted using: <a href="http://www.developerfusion.com/tools/convert/csharp-to-vb/" rel="nofollow noreferrer">http://www.developerfusion.com/tools/convert/csharp-to-vb/</a> )</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload