Jquery Grid有问题

时间:2014-02-21 22:03:03

标签: javascript jquery jquery-ui jqgrid mvcjqgrid

地狱之友,

我的模型类中有这个..

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Trirand.Web.Mvc;
using System.Web.UI.WebControls;

namespace JqGridModel.Models
{
    public class JqGridModel
    {
        public JQGrid OrdersGrid { get; set; }

        public JqGridModel()
        {
            OrdersGrid = new JQGrid
            {
                Columns = new List()
                                 {
                                     new JQGridColumn { DataField = "OrderID", 
                                                        // always set PrimaryKey for Add,Edit,Delete operations
                                                        // if not set, the first column will be assumed as primary key
                                                        PrimaryKey = true,
                                                        Editable = false,
                                                        Width = 50 },                                    
                                     new JQGridColumn { DataField = "CustomerID", 
                                                        Editable = true,
                                                        Width = 100 },
                                     new JQGridColumn { DataField = "OrderDate",                                                         
                                                        Editable = true,
                                                        Width = 100, 
                                                        DataFormatString = "{0:yyyy/MM/dd}" },
                                     new JQGridColumn { DataField = "Freight", 
                                                        Editable = true,
                                                        Width = 75 },
                                     new JQGridColumn { DataField = "ShipName",
                                                        Editable =  true
                                                      }                                     
                                 },
                Width = Unit.Pixel(640),
                Height = Unit.Percentage(100)
            };

            OrdersGrid.ToolBarSettings.ShowRefreshButton = true;
        }

    }
}

我收到此错误,

Error   1   'JQGrid' is a 'namespace' but is used like a 'type'

有人帮我解决了我在这里做错了吗?

提前致谢

1 个答案:

答案 0 :(得分:1)

Trirand下有一个名称空间,例如Trirand.Web.Mvc.JQGrid。由于您有一个指向Trirand.Web.Mvc的using语句,因此JQGrid在命名空间和类之间是不明确的。当您想要使用该类并删除using语句时,最简单的方法是引用完整的命名空间。

public Trirand.Web.Mvc.JQGrid OrdersGrid { get; set; }