Solved

The directive 'page' is unknown.

Posted on 2007-04-03
12
3,663 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

705 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