0

Hell Friends,

I have this in my model class..

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;
        }

    }
}

I am getting this Error,

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

Anybody help me out what I am doing wrong here?

Thanks in advance

user300485
  • 525
  • 5
  • 11
  • 24

1 Answers1

1

There is a namespace under Trirand such as Trirand.Web.Mvc.JQGrid. Since you've got a using statement pointing to Trirand.Web.Mvc, JQGrid is ambiguous between the namespace and the class. It's probably easiest to reference the full namespace when you want to use the class and remove the using statement.

public Trirand.Web.Mvc.JQGrid OrdersGrid { get; set; }
Chris Anderson
  • 666
  • 3
  • 4
  • Thank you Chris, But I am getting one more error saying that Error 2 Cannot initialize object of type 'List' with a collection – user300485 Feb 21 '14 at 22:29