Solved

The directive 'page' is unknown.

Posted on 2007-04-03
12
3,414 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now