Solved

The directive 'page' is unknown.

Posted on 2007-04-03
12
3,580 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

756 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