Solved

The directive 'page' is unknown.

Posted on 2007-04-03
12
3,527 Views
Last Modified: 2016-08-29
Following along in my book, and I was instructed to add my first user control.
I did so - it only includes an <h1> header.

Then, I followed the instructions to update an existing file (which 'was' working fine).
The 'only' changes I made, as instructed, were to add (the indented lines were already there):

    <%@ Page Language="VB" %>
<%@ Register TagPrefix="WroxUnited" TagName="SimpleHeader" Src="SimpleHeader.ascx" %>
<%@ import Namespace="System.Web.Caching" %>

And then further down into my html code,

     <form runat="server">
<WroxUnited:SimpleHeader id="HeaderControl" runat="server"></WroxUnited:SimpleHeader>

Now I'm getting the page directive is unknown?
I swear - I can take those 3 lines out and it runs fine...what happened? : \
       

0
Comment
Question by:sirbounty
12 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 18851691
Are you using Master pages with ASP.NET 2.0?

Bob
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18851700
Not familiar with Master pages, so presumably 'not'... : )
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 18851792
1) You should know if you were

2) You said that you could delete the @Page, @Register, and @Import lines, and it would work, so if you were using Master pages, that would definitely be a true statement, because the content for the pages in defined in the master, and not the page.

3) If you are not using master pages, then we need to find out the magic of how you could delete those directive lines, and it still works.

4) What is the base class for the web page?  Is it System.Web.UI.Page?

Bob
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 150 total points
ID: 18851798
Wait, you said that this was a user control, and the page directive would be rendered from the Page and not the UserControl, so you don't need those 3 lines in the UserControl.

Bob
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18852221
No, on my page (default.aspx) - I can remove the Register and IMport lines - not the Page...it works with page in there, but then if I add the other 2, it flags the Page directive as the error.
By your description, I don't believe I'm using Master Pages (yet).
I can upload the project if you'd like...
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18854569
I'm maxing the points here...I'd like to get this resolved so I can move along in my study.

https://filedb.experts-exchange.com/incoming/ee-stuff/3093-default.aspx.txthttps://filedb.experts-exchange.com/incoming/ee-stuff/3094-simpleheader.ascx.txt
 are the two files that I'm using...
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18854589
Even dropping this single line in yields the error - remove it and it runs...

<%@ Register TagPrefix="WroxUnited" TagName="SimpleHeader" Src="SimpleHeader.ascx" %>

Weird thing is that it points to "page" as the error, and in the 'preview' page that displayes "page" as being the error, it displays like this:


Line 1:  <%@ Page Language="VB" %>
Line 2:  <script runat="server">
Line 3:  
 

As if that line isn't in there anyway...? : \
0
 
LVL 5

Accepted Solution

by:
mzalewski earned 350 total points
ID: 18854625
My guess is that the 'Page directive' it's talking about is in the ascx file.
ASCX uses a @Control directive instead.
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18854635
Interestingly enough, if I remove the page directive it still works...
Then if I put it back in, farther down (into the html code), it complains about 2 directives.

The book instructed me to only insert the <h1> line in the contrl, but you're right - it's got the page directive there as well...removing it now...
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18854650
I split the points, cause re-reading this Bob, you were trying to tell me that before...but you both are correct - I removed everything (auto-added, I might mentioned) from the control and bingo...back in business.
Thanx!!!
0
 
LVL 12

Expert Comment

by:sandip132
ID: 18855533
sir,
please delete the pointer question also. I came here using that pointer, scratched my head for 5 minutes and scrolled to post the solution.
Bang! It is already solved! ;)
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18856512
My apologies!
Will do that post-haste! :^)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question