views:

840

answers:

2

I am having a little bit of trouble getting my aspx pages to recognize my tagPrefixes.

I have the standard ASP ones defined...

<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Then I have my custom controls defined below that but I do not think I am defining them properly because sometimes the page does not see any controls in the current context other times they work like a champ...

<add tagPrefix="mri" namespace="Mri.Controls" assembly="Mri.Controls"/>
<add tagPrefix="mri" namespace="Mri.Controls.Inputs" assembly="Mri.Controls"/>
<add tagPrefix="mri" namespace="Mri.Controls.Inputs.DropDowns" assembly="Mri.Controls"/>
<add tagPrefix="mri" namespace="Mri.Controls.Inputs.Search" assembly="Mri.Controls"/>

I have one namespace "Mri.Controls" and inside of that namespace I have several sub-folders, "Inputs" -> "DropDowns" etc...

What am I doing wrong? Currently the regular ASP controls are giving me an error: The name "blahBlah" does not exist in the current context.

+2  A: 

The sub-folders may or maynot become part of the namespace. By default, Visual Studio does include them when creating new classes but that can be removed in the class. If you moved the controls to the sub-folders, then the folder's name is likely not part of the namespace.

Also, make sure you are referencing your controls assembly or project within Visual Studio.

Andrew Robinson
A: 

Do you not also need the tagName attribute e.g.

<add tagPrefix="mri" tagName="Search" namespace="Mri.Controls.Inputs.Search" assembly="Mri.Controls"/>

<mri:Search ID="Search" runat="server"/>
Nick Allen - Tungle139
Don't need the tagname attribute. Class names become tag names.
Andrew Robinson
Oh ok. That's useful to know!
Nick Allen - Tungle139