我没有得到jqgrid [英] i am not getting the jqgrid

查看:95
本文介绍了我没有得到jqgrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的控制器



this is my controller

public JsonResult gridview() 
        {
  

  var jsonData = new {
    total = 1, //todo: calculate
    page = 1,
    records = db.TestModels.Count(),
    rows = (
      from question in db.TestModels.AsEnumerable()
      //where question.Emailid=="sudarshan@gmail.com"
      select new  {
        id = question.Dataid,
        cell = new string[3] { 
          question.Dataid.ToString(), question.Name, question.Emailid 
        } 
      }).ToArray()
  };
  return Json(jsonData, JsonRequestBehavior.AllowGet);
}
    }
}



这是我的观点




this is my view

<link rel="stylesheet" type="text/css" href="~/jqgrid/css/ui.jqgrid.css" 
  title="coffee" media="screen" />
<script src="~/Scripts/jquery-1.7.1.js" type="text/javascript"></script>
<script src="~/jqgrid/src/jquery.jqGrid.js" type="text/javascript"></script>
<script src="~/jqgrid/src/jqModal.js" type="text/javascript"></script>
<script src="~/jqgrid/src/jqDnR.js" type="text/javascript"></script>

<table id="list" class="scroll"></table>
<div id="pager" class="scroll" style="text-align:center;"></div>



<script type="text/javascript">
    jQuery(document).ready(function(){ 
      jQuery("#list").jqGrid({
          url: '/Test/gridview/',
        datatype: "json",
       
        colNames: ['Dataid', 'Name', 'Emailid'],
        colModel :[
         { name: 'Dataid', index: 'Dataid', width: 40, align: 'left' },
          { name: 'Name', index: 'Name', width: 40, align: 'left' },
          { name: 'Emailid', index: 'Emailid', width: 200, align: 'left' }],
        pager: jQuery('#pager'),
        rowNum:10,
        
        sortname: 'Dataid',
        sortorder: "desc",
        viewrecords: true,
       
          
        caption: "My  grid"
      }); 
    }); 
</script>

这个输出



and this the output

{"total":1,"page":1,"records":11,"rows":[{"id":18,"cell":["18","aditya","cast@gmail.com"]},{"id":19,"cell":["19","anil","anil@gmail.com"]},{"id":20,"cell":["20","cast","cast@gmail.com"]},{"id":21,"cell":["21","revision","revision@gmail.com"]},{"id":22,"cell":["22","sham","adityakashyap@gmail.com"]},{"id":23,"cell":["23","anil","aditya@gmail.com"]},{"id":24,"cell":["24","sham",null]},{"id":25,"cell":["25","anil","adityakashyap@gmail.com"]},{"id":26,"cell":["26","sudarshan","sudarshan@gmail.com"]},{"id":27,"cell":["27","board","board@gmail.com"]},{"id":28,"cell":["28","seen ","seen@gmail.com"]}]}



任何人都可以帮我解决


can anybody help me out

推荐答案

如果你是MVC的初学者那么请参考我的博客。

我还创建了解释它的视频。

关于MVC实体框架和JQGrid的简单演示。



我猜它对你有所帮助。



http://dotnetsourcedileep.blogspot.in/2014/06/test.html [^]
If your beginner to MVC then pls refere my blog.
I have also created videos explaining it.
A simple demo on MVC Entity framework and JQGrid.

I guess it will be helpfull for you.

http://dotnetsourcedileep.blogspot.in/2014/06/test.html[^]


这篇关于我没有得到jqgrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆