Reputation: 7
I have a class called ContactList that i make a instance of, but it claims it doesnt exist the Class is in the App_code folder and i have other pages that i could access other classes from, only this one wont work.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Data;
using System.Web.UI.WebControls;
namespace CSC237_SportsPro_Holmbeck
{
public partial class DisplayContact : System.Web.UI.Page
{
private ContactList list;
protected void Page_Load(object sender, EventArgs e)
{
list = ContactList.GetList();
if (!IsPostBack)
this.DisplayList();
}
private void DisplayList()
{
ContactListBox.Items.Clear();
for (int i = 0; i < list.Count; i++)
ContactListBox.Items.Add(this.list[i].Display());
}
Upvotes: 0
Views: 101
Reputation: 808
Upvotes: 0
Reputation: 29036
As the suggestions says, Press ctrl
+ .
it will show the suggestion list. select the appropriate namespace or include the line in the import sesction.
using projectFolder.App_Code;
Through this single line of code you are specifying the Namespace for the corresponding class.
Namespace are heavily used within C# programs in two ways. Firstly, the .NET Framework classes use namespaces to organize its many classes. Secondly, declaring your own namespaces can help control the scope of class and method names in larger programming projects.
Upvotes: 1