javascript - MVC 5 JQ grid not loading the data -
i written below piece of code loading jq grid controller grid not loading value
<script type="text/javascript"> $(this.document).ready(function () { debugger; $("#loadlogfile").jqgrid({ url: '/home/getresult', datatype: 'json', contenttype: "application/json; charset-utf-8", mtype: 'get', colname: ['log', 'name'], colmodel: [ { name: 'log', index: 'log', width: 20, stype: 'text' }, { name: 'name', index: 'name', width: 20, stype: 'text' } ], gridview: true, loadonce: true, viewrecords: true, rownum: 10, rowlist: [10, 20, 30], viewrecords: true, pager: '#pager', height: 'auto', width: '100%', autowidth: true, caption: "log file grid" }); jquery("#pager").jqgrid('navgrid', '#pager', { edit: false, add: false, del: false }); });
below c# code
[httpget] public jsonresult getresult() { // string[] list = directory.getfiles(@"d:\logs"); logfile log = new logfile(); log.log = "test"; log.name = "test"; logfile log1 = new logfile(); log1.log = "test1"; log1.name = "test1"; list<logfile> llog = new list<logfile>(); llog.add(log); llog.add(log1); var json = jsonconvert.serializeobject(llog); return json(json, jsonrequestbehavior.allowget); }
not sure coding going wrong below js , css files whic called in layout page
<link href="~/content/ui.jqgrid.css" rel="stylesheet" /> <script src="~/scripts/jquery-1.10.2.js"></script> <link href="~/scripts/jquery-ui.css" rel="stylesheet" /> <script src="~/scripts/i18n/grid.locale-en.js"></script> <script src="~/scripts/jquery.jqgrid.js"></script>
Comments
Post a Comment