Mani shankar
Mani shankar

Reputation: 71

How can I bind the IQueryable data to the asp gridview

I want to bind the IQueryable data to the asp gridview

Here is my code from the controller page. please check it.

 public IQueryable<OrdersView> Data()
       {
       NorthwindDataContext db = new NorthwindDataContext();
       var a = db.OrdersViews;
       return a;
    }

And in the index.cshtml page i have used selectMethod to call the method from the controller. I have tried a lot but I can't able to achieve this.

Please note I don't need an IEnumerable type but I need just IQueryable data to bind for the grid.

Anybody please help me on this query

Thanks in advance.

Upvotes: 0

Views: 326

Answers (1)

Hamed
Hamed

Reputation: 588

You can simply make it with AsQueryable:

var a = db.OrdersViews.AsQueryable();

Upvotes: 1

Related Questions