Pergunta

I am getting a error for my namespace that says " the type or namespace name could not be found (are you missing a using directive or an assembly reference?) " and have no idea why... i have been trying to figure this one out for hours now... btw i am a newbie with c#

using System;
using System.Data; 
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using portfolioNamespace;  

public partial class DefaultCode : System.Web.UI.Page{

    Portfolio myPortfolio;

    protected void Page_Load(object sender, EventArgs e){
        //declare
        myPortfolio = new Portfolio();
        populate();
    } 

    private void populate(){
        //populate everything
        populateMenu();
        populateHome();
        populateSamples();
        populateAbout();
    }

    private void populateMenu(){
        //populate the menu
        String[] menu;
        menu = myPortfolio.getMyMenu();

        repLinks.DataSource = menu;
        repLinks.DataBind();
        //populates a hidden text box so i can get an array in javascript 
        for (int i = 0; i<=menu.Length - 1; i++){
            dummy.Value = dummy.Value & menu(i) & "-";
        }
    }

    private void populateHome(){
        //populate home 
        homeRepeater.DataSource = myPortfolio.getHomeInfo;
        homeRepeater.DataBind();
    }

    private void populateSamples(){
        //populate samples
        samplesRepeater.DataSource = myPortfolio.getSamplesInfo;
        samplesRepeater.DataBind();
    }

    private void populateAbout(){
        //populate about
        aboutRepeater.DataSource = myPortfolio.getAboutInfo;
        aboutRepeater.DataBind();
    }

}

Nenhuma solução correta

Outras dicas

In your Solution Explorer Right click your References, click Add Reference > Browse, then find your dll file that contains portfolioNamespace and add it to your References.

See documentation for more details: How to: Add or Remove References By Using the Add Reference Dialog Box

You probably haven't created the portfolioNamespace.

You do so by wrapping your code in

namespace portfolioNamespace
{
 //your code here
}

Have a read through these references, namespace (C# Reference) and Namespaces (C# Programming Guide)

It is not clear which file is getting error.

whatever the class name is giving error put cursor on that and press CTRL + DOT(.) it will suggest you to add the correct name space

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top