jqGrid - 添加,编辑,搜索按钮不起作用

时间:2014-05-24 22:52:53

标签: asp.net-mvc jqgrid jqgrid-asp.net

我根据this topic做了jqGrid。我有几个问题。我会很感激一段代码

  1. 为什么添加按钮,编辑按钮重复?的 [解决]
  2. 我可以做些什么来使其搜索,添加和编辑?
  3. 为什么在添加navGrid后切换边停止工作?

    更新

  4. editurl: "/Home/GridEdit",我添加了代码cshtml。

    控制器 VER1

    public ActionResult GridEdit(int id, string Name, string Age)
    {
        Cat e = DB.Cats.SingleOrDefault(p => p.CatID == id);
        if (!(e == null))
        {
            e.CatName = Name;
            e.Age = Age;
            DB.SaveChanges();
            return Content("true");
        }
        else
        {
            return Content("false");
        }
    }
    

    VER2

    public ActionResult GridEdit(Cat cat)
    {
        if (ModelState.IsValid)
        {
            DB.Entry(cat).State = EntityState.Modified;
            DB.SaveChanges();
            return RedirectToAction("Index");
        }
        return View();
    }
    

    他们都没有工作......

    enter image description here

1 个答案:

答案 0 :(得分:0)

  • 2)为什么搜索添加编辑删除不工作

    • 让你的分页工作你需要在你的代码中添加一些代码

      • 与添加产品类似

      public HttpResponseMessage PostProduct(Product item) { //Codes }

      • 喜欢编辑产品

      public void PutProduct(int id, Product item) { //Codes }

    • 记住这些PostProducts,PutProducts是我的界面

  • 1)为什么添加Edit is Duplicate
    • 这些工具提示是可编辑的,您可以编辑它。通过文档,您将找到方式