Click to See Complete Forum and Search --> : Error in C# Code for ASP.net site


ivanjay205
07-27-2010, 11:31 AM
I am following along a book I purchased, ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio

I am getting the following errors:


Error 1 The name 'MenuTabs1' does not exist in the current context C:\Documents and Settings\iweiss\my documents\visual studio 2010\Projects\Elite Tool Kit\UI\EliteToolKit.Master.cs 21 9 UI


Error 2 The name 'Globals' does not exist in the current context C:\Documents and Settings\iweiss\my documents\visual studio 2010\Projects\Elite Tool Kit\UI\EliteToolKit.Master.cs 21 31 UI

EliteToolKit.Master.Cs

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using BLL.Framework;
using FrameworkControls;

public partial class EliteToolKit : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
//Set the top menu properties
MenuTabs1.Menuitems = Globals.GetMenuItems(this.Cache);


}
}

Global.cs (which is in App-Code)

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.Caching;
using BLL.Framework;


/// <summary>
/// Summary description for Globals
/// </summary>
public static class Globals
{
#region Constants

private const string CACHE_KEY_MENU_ITEMS = "MenuItems";
private const string CACHE_KEY_USERS = "Users";

#endregion Constants

#region Methods

public static ENTMenuItemBOList GetMenuItems(Cache cache)
{
//Check if the menus have been cached.
if (cache[CACHE_KEY_MENU_ITEMS] == null)
{
LoadMenuItems(cache);
}

return (ENTMenuItemBOList)cache[CACHE_KEY_MENU_ITEMS];
}

public static ENTUserAccountEOList GetUsers(Cache cache)
{
//Check for the users
if (cache[CACHE_KEY_USERS] == null)
{
LoadUsers(cache);
}

return (ENTUserAccountEOList)cache[CACHE_KEY_USERS];
}

public static void LoadMenuItems(Cache cache)
{
ENTMenuItemBOList menuItems = new ENTMenuItemBOList();
menuItems.Load();

cache.Remove(CACHE_KEY_MENU_ITEMS);
cache[CACHE_KEY_MENU_ITEMS] = menuItems;
}

public static void LoadUsers(Cache cache)
{
ENTUserAccountEOList users = new ENTUserAccountEOList();
users.Load();

cache.Remove(CACHE_KEY_USERS);
cache[CACHE_KEY_USERS] = users;
}

#endregion Methods
}

Any ideas???

Thanks!

scousesheriff
08-11-2010, 08:21 AM
Hi

Is there an item on the .aspx page for the master page?

Not used the app-code directory before, but it could be that you need to include the class with a "using..." statement because it is not in a namespace.