I'm using an html template with plugin fullcalendar. I need load event from database using events as a json feed
There are many example to do this with $.ajax but I want to use native plugin tools.
Who I can do this with asp.net? I'm using webform.
Thanks in advance
Update: I've created a webservice to return JSON data. This is the code:
Imports System.Web.Script.Serialization
Imports System.Web.Script.Services Imports System.Web.Services
<WebService([Namespace]:="http://tempuri.org/")>
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
<System.ComponentModel.ToolboxItem(False)>
Public Class Calendar
Inherits System.Web.Services.WebService
Public Class DateCalendario
Public Property Title As String
Public Property Start As String
Public Property myEnd As String
End Class
<WebMethod>
<ScriptMethod(ResponseFormat:=ResponseFormat.Json)>
Public Sub GetCalendarDate(Start as string, EndDate As String)
Dim obj As DateCalendario()
obj = New DateCalendario() {New DateCalendario() With {
.Title = "Evento di prova",
.Start = "2020-12-05T09:00:00",
.myend = "2020-12-05T18:00:00"
}, New DateCalendario() With {
.Title = "Evento di test",
.Start = "2020-12-07T09:00:00",
.myend = "2020-12-07T18:00:00"
}}
Dim js As JavaScriptSerializer = New JavaScriptSerializer
Context.Response.Write(js.Serialize(obj))
End Sub
End Class
Problem is that I cannot use word end to set class property name so I've used myend. Also when RUN webpage return an error: "Failed to load resource: the server responded with a status of 500 (Internal Server Error)" with this URL: http://localhost:49988/Webservice/Calendar.asmx/GetCalendarDate?start=2020-11-30&end=2021-01-11&_=1607451959751
Whats wrong? Someone can post a correct sample to return correct data. According plugin documentation this is an example that work:
[
{
"title": "Event 1",
"start": "2019-09-05T09:00:00",
"end": "2019-09-05T18:00:00"
},
{
"title": "Event 2",
"start": "2019-09-08",
"end": "2019-09-10"
}
]
Searching log on my PC found this problem:
Event code: 3005 Event message: Eccezione non gestita. Event time: 09/12/2020 14:14:32 Event time (UTC): 09/12/2020 13:14:32 Event ID: d435a05e13d647bcadaa423135ba29b4 Event sequence: 32 Event occurrence: 3 Event detail code: 0 Application information: Application domain: /LM/W3SVC/2/ROOT-2-132519685992168059 Trust level: Full Application Virtual Path: / Application Path: C:\Users\corradolembo\Documents\Visual Studio 2019\WebSite\DupigestADV\ Machine name: CORRADOLEMB975D Process information: Process ID: 14848 Process name: iisexpress.exe Exception information: Exception type: InvalidOperationException Exception message: Formato della richiesta non riconosciuto. L'URL termina in modo imprevisto con '/GetCalendarDate'. in System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) in System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) in System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) in System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() in System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
in System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) Request information: Request URL: http://localhost:49988/Webservice/Calendar.asmx/GetCalendarDate?start=2020-11-30&end=2021-01-11&_=1607519672582Request path: /Webservice/Calendar.asmx/GetCalendarDate User host address: ::1 User:
Is authenticated: False Authentication Type: Thread information: Thread ID: 25 Is impersonating: False Stack trace: in System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) in System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) in System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) in System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() in System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
in System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
What is the problem?