CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.vs_2005_web_application_projects Tags:
Item Type: NewsGroup Date Entered: 9/1/2006 7:35:12 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 2 Views: 258 Favorited: 0 Favorite
3 Items, 1 Pages 1 |< << Go >> >|
netpoweron
Asp.Net User
Unknown Server Tag issue Continued.9/1/2006 7:35:12 AM

0

I just recently converted over a rather large Web App in VS2005 using the old model of just write and run using the Built In Web Server for development then using the Depoyment Project to build and upload to an IIS server.  Always worked fine.

 Now I've converted over to a WAP and even well renamed some name spaces which worked poorly, but still elimnated alot of work but it of course missed all the ASPX files that mentioned the name space.  This is a refactor bug that I hope is fixed someday.

 Anyhow I get "Unknown Server Tag" errors when I run the app now.  For example.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<%@ Register TagPrefix="it" Namespace="WebApplication1.classes" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <% _lb.Text = System.DateTime.Now.ToString( ); %>
        <asp:Label ID="_lb" runat="server" />
        <it:TextBoxEx ID="_tbex" runat="server" />
    </div>
    </form>
</body>
</html>

 would produce this error. 
Error 1 Element 'TextBoxEx' is not a known element. This can occur if there is a compilation error in the Web site. C:\Documents and Settings\dking\My Documents\Visual Studio 2005\Projects\WebApplication1\WebApplication1\Default.aspx 13 13 WebApplication1

TextBoxEx is in the directory classes
 

namespace WebApplication1.classes
{
  public class TextBoxEx : System.Web.UI.WebControls.TextBox
  {
    public TextBoxEx( ) : base( )
    {
      Text = "Hello World";
    }
  }
}
Ok All this code just to make this one point however in the ASPX file you could write a register statement like this.
<%@ Register TagPrefix="it" Namespace="WebApplication1.classes" %>

but this won't work because it won't be able to find the Assembly, but what we want is it to use the assembly that the entire project is compiling to.
Before using a WAP this would work fine and it would compile.  Or you could do something like this
<%@ Register TagPrefix="it" Namespace="WebApplication1.classes" Assembly="__code" %>
And this would also work, but now it doesn't the only thing that I have found that works would be to do this.
<%@ Register TagPrefix="it" Namespace="WebApplication1.classes" Assembly="WebApplication1" %>

So I must use the assembly name of the project in every place that I used a compiled in simple tweak of a .NET web control

How can I specifiy to register the control using the project assembly file in an abstract way?  like saying __code or not putting an assembly attribute at all?

joeaudette
Asp.Net User
Re: Unknown Server Tag issue Continued.9/1/2006 4:54:39 PM

0

You do need the assembly but you can configure it in web.config under system.web section so you don't have to do it in every page or usercontrol.

Something like this example:

<pages>
    <namespaces>
        <add namespace="mojoPortal.Business" />

    </namespaces>
    <controls>
        <add namespace="MagicAjax.UI.Controls" assembly="MagicAjax" tagPrefix="ajax"/>
       
    </controls>
   
</pages>

Hope it helps,

Joe 


http://www.joeaudette.com
http://www.mojoportal.com
mojoPortal is an Open Source CMS/Portal featuring WebParts and supporting MSSQL, MySQL, PostgreSQL, SQLite, and Firebird Sql
netpoweron
Asp.Net User
Re: Unknown Server Tag issue Continued.9/2/2006 8:37:19 PM

0

Well that certainly is a good solution.  With this I don't even need to use the <% register %> anymore and if I change the name of my Assembly I just need to change it in the Web.Config because well I know you shouldn't need to change the name of the assembly even if it was called dumpwebapp.dll. 

Thanks,

3 Items, 1 Pages 1 |< << Go >> >|


Free Download:




   
  Privacy | Contact Us
All Times Are GMT