I'm trying to create a keno grid and fill it from db with addresses data. When I run the application neither the grid nor data displayed. This is the web service code:
namespace SmartFramework.ControllerWebServices
{
/// <summary>
/// Summary description for SalesWebService
/// </summary>
[WebService(Namespace = "http://localhost:56785/ControllerWebServices/SalesWebService.asmx")]
[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 SalesWebService : System.Web.Services.WebService
{
[WebMethod]
public XmlDocument GetAddresses()
{
XmlDocument myDocument = new XmlDocument();
string temp;
AddressBE myAddress = new AddressBE();
myAddress.LoadAll();
temp = myAddress.ToXml();
myDocument.LoadXml(temp);
return myDocument;
}
}
}
This is the aspx page code that contains the keno grid and datasource:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Address.aspx.cs" Inherits="SmartFramework.UIL.Address" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Address</title>
<link href="Kendo-UI/styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="Kendo-UI/styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
<script src="Kendo-UI/js/jquery.min.js" type="text/javascript"></script>
<script src="Kendo-UI/js/kendo.web.min.js" type="text/javascript"></script>
<!--<link href="Kendo-UI/styles/kendo.dataviz.min.css" rel="stylesheet" type="text/css" />-->
<script src="Kendo-UI/js/jquery.min.js" type="text/javascript"></script>
<!--<script src="Kendo-UI/js/kendo.dataviz.min.js" type="text/javascript"></script>-->
</head>
<body>
<!--<form id="form1" runat="server">-->
<div>
<script>
$(document).ready(function () {
//alert("hii");
$("#grid").kendoGrid({
dataSource: {
//type: "POST",
transport:
{
read:{
type: "POST",
url: "http://localhost:56785/ControllerWebServices/SalesWebService.asmx/GetAddresses",
//contentType: "application/json; charset=utf-8",
dataType: "xml",
processData: false,
data: xmlstring
}
},
schema:
{
data: "//Address",
model:
{
fields:
{
AddressID: { type: "number" },
AddressLine1: { type: "string" },
AddressLine2: { type: "string" },
City: { type: "string" },
StateProvince: { type: "string" },
CountryRegion: { type: "string" },
PostalCode: { type: "string" },
rowguid: { type: "number" },
ModifiedDate: { type: "string" }
}
}
},
pageSize: 10,
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
height: 250,
filterable: true,
sortable: true,
pageable: true,
columns:
[
{
field: "AddressID",
title: "ID"
},
{
field: "AddressLine1",
title: "AddressLine1"
},
{
field: "AddressLine2",
title: "AddressLine2"
},
{
field: "City",
title: "City"
},
{
field: "StateProvince",
title: "StateProvince"
},
{
field: "CountryRegion",
title: "CountryRegion"
},
{
field: "PostalCode",
title: "PostalCode"
},
{
field: "rowguid",
title: "rowguid"
},
{
field: "ModifiedDate",
title: "ModifiedDate"
}
]
/*columns: [{
field: "OrderID",
filterable: false
},
"Freight",
{
field: "OrderDate",
title: "Order Date",
width: 100,
format: "{0:MM/dd/yyyy}"
}, {
field: "ShipName",
title: "Ship Name",
width: 200
}, {
field: "ShipCity",
title: "Ship City"
}
]*/
});
});
</script>
</div>
<!-- </form>-->
</body>
</html>
Please note that I want the data to be as xml in order to call any webservice that returns data as xml. Anyone can help me to find the problem?
namespace SmartFramework.ControllerWebServices
{
/// <summary>
/// Summary description for SalesWebService
/// </summary>
[WebService(Namespace = "http://localhost:56785/ControllerWebServices/SalesWebService.asmx")]
[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 SalesWebService : System.Web.Services.WebService
{
[WebMethod]
public XmlDocument GetAddresses()
{
XmlDocument myDocument = new XmlDocument();
string temp;
AddressBE myAddress = new AddressBE();
myAddress.LoadAll();
temp = myAddress.ToXml();
myDocument.LoadXml(temp);
return myDocument;
}
}
}
This is the aspx page code that contains the keno grid and datasource:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Address.aspx.cs" Inherits="SmartFramework.UIL.Address" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Address</title>
<link href="Kendo-UI/styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="Kendo-UI/styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
<script src="Kendo-UI/js/jquery.min.js" type="text/javascript"></script>
<script src="Kendo-UI/js/kendo.web.min.js" type="text/javascript"></script>
<!--<link href="Kendo-UI/styles/kendo.dataviz.min.css" rel="stylesheet" type="text/css" />-->
<script src="Kendo-UI/js/jquery.min.js" type="text/javascript"></script>
<!--<script src="Kendo-UI/js/kendo.dataviz.min.js" type="text/javascript"></script>-->
</head>
<body>
<!--<form id="form1" runat="server">-->
<div>
<script>
$(document).ready(function () {
//alert("hii");
$("#grid").kendoGrid({
dataSource: {
//type: "POST",
transport:
{
read:{
type: "POST",
url: "http://localhost:56785/ControllerWebServices/SalesWebService.asmx/GetAddresses",
//contentType: "application/json; charset=utf-8",
dataType: "xml",
processData: false,
data: xmlstring
}
},
schema:
{
data: "//Address",
model:
{
fields:
{
AddressID: { type: "number" },
AddressLine1: { type: "string" },
AddressLine2: { type: "string" },
City: { type: "string" },
StateProvince: { type: "string" },
CountryRegion: { type: "string" },
PostalCode: { type: "string" },
rowguid: { type: "number" },
ModifiedDate: { type: "string" }
}
}
},
pageSize: 10,
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
height: 250,
filterable: true,
sortable: true,
pageable: true,
columns:
[
{
field: "AddressID",
title: "ID"
},
{
field: "AddressLine1",
title: "AddressLine1"
},
{
field: "AddressLine2",
title: "AddressLine2"
},
{
field: "City",
title: "City"
},
{
field: "StateProvince",
title: "StateProvince"
},
{
field: "CountryRegion",
title: "CountryRegion"
},
{
field: "PostalCode",
title: "PostalCode"
},
{
field: "rowguid",
title: "rowguid"
},
{
field: "ModifiedDate",
title: "ModifiedDate"
}
]
/*columns: [{
field: "OrderID",
filterable: false
},
"Freight",
{
field: "OrderDate",
title: "Order Date",
width: 100,
format: "{0:MM/dd/yyyy}"
}, {
field: "ShipName",
title: "Ship Name",
width: 200
}, {
field: "ShipCity",
title: "Ship City"
}
]*/
});
});
</script>
</div>
<!-- </form>-->
</body>
</html>