Somehow the JQGrid is not invoking the aspx page function at all. I dont know what I am doing wrong. this is the first time, I am trying to use the combination of XML & aspx. I dont want to use the ASHX & JSON.
<script src="jqgrid/jquery-1.10.2.js" type="text/javascript"></script>
<script src="jqgrid/jquery-ui-1.10.4.custom.js" type="text/javascript"></script>
<script src="jqgrid/jquery-ui-1.10.4.custom.min.js" type="text/javascript"></script>
<script src="jqgrid/jquery.jqGrid.js" type="text/javascript"></script>
<script src="jqgrid/grid.locale-en.js" type="text/javascript"></script>
<asp:Content ID="Content1" ContentPlaceHolderID="headContent" runat="Server">
<script type="text/javascript">
$(document).ready(function () {
$("#list").jqGrid({
url: "http://XMLCheck.aspx/getData",
datatype: 'xmlstring',
ajaxGridOptions: { contentType: 'application/xml; charset=utf-8' },
mtype: 'POST',
colNames: ['Inv No', 'Date', 'Amount', 'Tax', 'Total', 'Notes'],
colModel: [
{ name: 'invid', index: 'invid', width: 55, sorttype: 'int' },
{ name: 'invdate', index: 'invdate', width: 90, sorttype: 'date', datefmt: 'Y-m-d' },
{ name: 'amount', index: 'amount', width: 80, align: 'right', sorttype: 'float' },
{ name: 'tax', index: 'tax', width: 80, align: 'right', sorttype: 'float' },
{ name: 'total', index: 'total', width: 80, align: 'right', sorttype: 'float' },
{ name: 'note', index: 'note', width: 150, sortable: false }],
pager: '#pager',
rowNum: 10,
viewrecords: true
});
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
<table id="list"></table>
<div id="pager"></div>
</asp:Content>
aspx page has
<WebMethod> _
Public Shared Function getData() As String
Return "<?xml version='1.0' encoding='utf-8'?><invoices><rows><row><cell>data1</cell><cell>data2</cell><cell>data3</cell><cell>data4</cell><cell>data5</cell><cell>data6</cell></row></rows></invoices>"
End Function
No comments:
Post a Comment