Hi,
I have a mobile project, where I need fill ListView with JSON data. All data is on one row.

I try to change data, model, ... and another settings, but nothing is help me.
This is my source code.
Webservice:
I need get list view with rows, I get only one row with all data.
I don't know, where I do mistake. Can you help me.
Thanks.
Roman
I have a mobile project, where I need fill ListView with JSON data. All data is on one row.
I try to change data, model, ... and another settings, but nothing is help me.
This is my source code.
<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Ecommerce.m.Default" %>
<!DOCTYPE html>
<
html
>
<
head
>
<
title
>Ecommerce</
title
>
<
meta
name
=
"viewport"
content
=
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;"
/>
<
meta
charset
=
"utf-8"
>
<
link
href
=
"styles/kendo.mobile.all.min.css"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
script
src
=
"js/jquery.min.js"
type
=
"text/javascript"
></
script
>
<
script
src
=
"js/kendo.mobile.min.js"
type
=
"text/javascript"
></
script
>
</
head
>
<
body
>
<
div
data-role
=
"view"
id
=
"tabstrip-flat"
data-title
=
"Result - view"
data-init
=
"mobileListViewDataBindInitFlat"
data-layout
=
"mobile-tabstrip"
>
<
ul
id
=
"flat-listview"
></
ul
>
</
div
>
<
div
data-role
=
"layout"
data-id
=
"mobile-tabstrip"
>
<
header
data-role
=
"header"
>
<
div
data-role
=
"navbar"
>
<
a
class
=
"nav-button"
data-align
=
"left"
data-role
=
"backbutton"
>Back</
a
>
<
span
data-role
=
"view-title"
></
span
>
<
a
data-align
=
"right"
data-role
=
"button"
class
=
"nav-button"
href
=
"#index"
>Index</
a
>
</
div
>
</
header
>
<
footer
data-role
=
"footer"
>
<
div
data-role
=
"tabstrip"
>
<
a
href
=
"#tabstrip-flat"
data-icon
=
"stop"
>Flat</
a
>
</
div
>
</
footer
>
</
div
>
<
script
type
=
"text/javascript"
>
var searchDataSource;
searchDataSource = new kendo.data.DataSource(
{
schema: {
data: function (data) {
alert(data.d); /*Data Return Successfully*/
return data.d;
},
//model: {}
model: {
fields: {
Name: { type: "string" },
Company: { type: "string" },
Address: { type: "string" },
Phone: { type: "string" },
Country: { type: "string" }
}
}
},
transport: {
read: {
contentType: "application/json; charset=utf-8",
type: "POST",
dataType: "json",
url: "WebServiceData.asmx/TestJSON"
}
}
});
function mobileListViewDataBindInitFlat() {
$("#flat-listview").kendoMobileListView({
dataSource: searchDataSource
//group: "Country"
});
}
</
script
>
<
script
type
=
"text/javascript"
>
//new kendo.mobile.Application($(document.body), { layout: "foo" });
var app = new kendo.mobile.Application();
</
script
>
</
body
>
</
html
>
Webservice:
[WebService(Namespace =
"http://tempuri.org/"
)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(
false
)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public
class
WebServiceProduct : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public
string
TestJSON()
{
Employee[] e =
new
Employee[2];
e[0] =
new
Employee();
e[0].Name =
"Name1"
;
e[0].Company =
"Birlasoft Ltd."
;
e[0].Address =
"LosAngeles California"
;
e[0].Phone =
"1204675"
;
e[0].Country =
"US"
;
e[1] =
new
Employee();
e[1].Name =
"Name2"
;
e[1].Company =
"Birlasoft Ltd."
;
e[1].Address =
"D-195 Sector Noida"
;
e[1].Phone =
"1204675"
;
e[1].Country =
"India"
;
string
sReturn =
new
JavaScriptSerializer().Serialize(e);
return
new
JavaScriptSerializer().Serialize(e);
}
public
class
Employee
{
public
string
Name {
get
;
set
; }
public
string
Company {
get
;
set
; }
public
string
Address {
get
;
set
; }
public
string
Phone {
get
;
set
; }
public
string
Country {
get
;
set
; }
}
}
I need get list view with rows, I get only one row with all data.
I don't know, where I do mistake. Can you help me.
Thanks.
Roman