This is a migrated thread and some comments may be shown as answers.

Listview databinding

0 Answers 119 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
Roger
Top achievements
Rank 1
Roger asked on 16 Mar 2012, 07:43 AM
Hi,
am trying to provide json databinding functionality to listview..am using your grid-page-methods-crud demo but it's not working.
The list is:
<ul id="Appointment_listview"></ul>

the script is:
<script type="text/javascript">
 
    var listData = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: "Service.asmx/GetAppointment",
                        dataType: "jsonp",
                        data: { //additional parameters sent to the remote service
                            q: "javascript"
                        }
                    }
                },
                schema: { // describe the result format
                    data: "results" // the data which the data source will be bound to is in the "results" field
                }
            });
 
    function mobileListViewDataBindInitFlat() {
        $("#Appointment_listview").kendoMobileListView({
            template: "<a href='details.aspx?id=${data.id}'>${data.subject}</a>",
            dataSource: listData
        });
    }
</script>

and the web service is
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
 
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://star1.com.au/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Service
    Inherits System.Web.Services.WebService
    <WebMethod()> _
    Public Shared Function GetAppointment() As IEnumerable(Of AppointmentSummary)
        Dim dt As DataTable = DataManager.Appointments_Get(SessionManager.AppID, SessionManager.UserID, Date.Now)
        Dim var As New List(Of AppointmentSummary)
        For Each dr As DataRow In dt.Rows
            Dim apt As New AppointmentSummary
            With apt
                .id = dr("id").ToString
                .subject = dr("Subject").ToString & " (" & CDate(dr("Start")).ToShortDateString & " " & CDate(dr("Start")).ToShortTimeString & ")"
            End With
            var.Add(apt)
        Next
        Return var.ToList
    End Function
End Class

of course I finish off the script with:
<script type="text/javascript">
    var app = new kendo.mobile.Application(document.body);
</script>

the page loads with the header & viewing the console I get this error
GET http://localhost:56634/main/Service.asmx/GetAppointment?callback=jQuery17106404353028628975_1331880114840&q=javascript&_=1331880115408 500 (Internal Server Error)

When I had the web service on the maindefault page I was getting javascript errors thta it couldn't find kendo object ?????

Any suggestions?









No answers yet. Maybe you can help?

Tags
ListView (Mobile)
Asked by
Roger
Top achievements
Rank 1
Share this question
or