A using namespace directive can only be applied to namespaces;

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Restok
    New Member
    • Dec 2011
    • 1

    A using namespace directive can only be applied to namespaces;

    Full error text: A using namespace directive can only be applied to namespaces; 'Search' is a type not a namespace.

    FYI "Search" is my custom namespace, made in a seperate .cs(class) file in a App_Code folder.
    Pardon for the foreign language. It's my Database that's Danish, because this is a school project and they provide the database. I can translate it if it doesn't make any sense.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


    using System;
    using System.Collecti ons.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.W ebControls;
    using Search;

    public partial class FindBolig : System.Web.UI.P age
    {
    protected void Page_Load(objec t sender, EventArgs e)
    {

    }

    protected void btnSearch_Click (object sender, EventArgs e)
    {
    List<objSearch. objSelectBetwee n> lstSearhBetween = new List<objSearch. objSelectBetwee n>();
    List<objSearch. objSelect> lstSearhSelect = new List<objSearch. objSelect>();

    if (!string.IsNull OrEmpty(txtPris Min.Text) && !string.IsNullO rEmpty(txtPrisM ax.Text))
    {
    if (txtPrisMax.Tex t != "0")
    {
    objSearch.objSe lectBetween pris = new objSearch.objSe lectBetween();
    pris.DataFieldN ame = "Pris";
    pris.MinValue = Convert.ToInt32 (txtPrisMin.Tex t);
    pris.MaxValue = Convert.ToInt32 (txtPrisMax.Tex t);
    lstSearhBetween .Add(pris);
    }
    }

    if (!string.IsNull OrEmpty(txtGrun dMin.Text) && !string.IsNullO rEmpty(txtGrund Max.Text))
    {
    if (txtGrundMax.Te xt != "0")
    {
    objSearch.objSe lectBetween grund = new objSearch.objSe lectBetween();
    grund.DataField Name = "Grund";
    grund.MinValue = Convert.ToInt32 (txtGrundMin.Te xt);
    grund.MaxValue = Convert.ToInt32 (txtGrundMax.Te xt);
    lstSearhBetween .Add(grund);
    }
    }

    if (!string.IsNull OrEmpty(txtBoli gMin.Text) && !string.IsNullO rEmpty(txtBolig Max.Text))
    {
    if (txtBoligMax.Te xt != "0")
    {
    objSearch.objSe lectBetween bolig = new objSearch.objSe lectBetween();
    bolig.DataField Name = "Grund";
    bolig.MinValue = Convert.ToInt32 (txtBoligMin.Te xt);
    bolig.MaxValue = Convert.ToInt32 (txtBoligMax.Te xt);
    lstSearhBetween .Add(bolig);
    }
    }

    if (!string.IsNull OrEmpty(txtBrut toMin.Text) && !string.IsNullO rEmpty(txtBrutt oMax.Text))
    {
    if (txtBruttoMax.T ext != "0")
    {
    objSearch.objSe lectBetween brutto = new objSearch.objSe lectBetween();
    brutto.DataFiel dName = "Brutto";
    brutto.MinValue = Convert.ToInt32 (txtBruttoMin.T ext);
    brutto.MaxValue = Convert.ToInt32 (txtBruttoMax.T ext);
    lstSearhBetween .Add(brutto);
    }
    }

    if (!string.IsNull OrEmpty(txtNett oMin.Text) && !string.IsNullO rEmpty(txtNetto Max.Text))
    {
    if (txtNettoMax.Te xt != "0")
    {
    objSearch.objSe lectBetween netto = new objSearch.objSe lectBetween();
    netto.DataField Name = "Brutto";
    netto.MinValue = Convert.ToInt32 (txtNettoMin.Te xt);
    netto.MaxValue = Convert.ToInt32 (txtNettoMax.Te xt);
    lstSearhBetween .Add(netto);
    }
    }

    foreach (ListItem item in lstBoligTyper.I tems)
    {
    if (item.Selected)
    {
    int BoligTypeID = Convert.ToInt32 (item.Value);

    objSearch.objSe lect boligType = new objSearch.objSe lect();
    boligType.DataF ieldName = "BoligTypeI D";
    boligType.Value ID = BoligTypeID;

    lstSearhSelect. Add(boligType);
    }
    }

    SearchBLL.Searc hAdvanced(lstSe arhBetween, lstSearhSelect, "Derp");

    }
    }

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    If you guys need more info in order to help, do tell. I'll post it right away.

    Restok
Working...