Error: Type or namespace name could not be found

Error message when trying to use LINQ to SQL class for paging

Page 1 of 1

0 Replies - 1202 Views - Last Post: 25 March 2010 - 07:13 PM Rate Topic: -----

#1 ebulyar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 18-March 10

Error: Type or namespace name could not be found

Posted 25 March 2010 - 07:13 PM

I am trying to use data source paging to page through records in grid view. I have created a LINQ to SQL class called BulkViewHistory.dbml. The name property of this class is set to BulkViewHistoryDataContext. Their is no Context Namespace or Entity Namespace values.

Now I have another class called BulkHistoryPaging.cs. Here is the code in that class.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using System.Web;



/// <summary>
/// Summary description for BulkHistoryPaging
/// </summary>
public class BulkHistoryPaging
{

    public static IEnumerable<BulkHistoryPaging> GetBulkHistory(int startRowIndex, int maximumRows)
    {

        BulkViewHistoryDataContext db = new BulkViewHistoryDataContext();
        return db.tblBulk.skip(startRowIndex).Take(maximumRows);

    }

    public static int GetBulkHistoryCount()
    {

        HttpContext context = HttpContext.Current;
        if (context.Cache["BulkHistoryCount"] == null)
        {

            context.Cache["BulkHistoryCount"] = GetBulkHistoryCountFromDB();

        }

        return (int)context.Cache["BulkHistoryCount"];

    }

    private static int GetBulkHistoryCountFromDB()
    {

        BulkViewHistoryDataContext db = new BulkViewHistoryDataContext();
        return db.tblBulk.count();

    }
}



What it keeps erroring out on is the BulkViewHistoryDataContext. I receive an error message that says "The type or namespace name 'BulkViewHistoryDataContext' could not be found (are you missing a using directive or an assembly directive?).

The code for the Data Source object that is referencing this is:
<asp:ObjectDataSource 
            ID="srcBulkHistoryPaging" 
            TypeName="BulkHistoryPaging" 
            SelectMethod="GetBulkHistory" 
            SelectCountMethod="GetBulkHistoryCount" 
            EnablePaging="true" 
            runat="server" />


I know I am missing something small. But I just can't seem to figure it out. Thank you for your time!
D. Elizabeth Bulyar

Is This A Good Question/Topic? 0
  • +

Page 1 of 1