The directive 'Control' is unknown.

  • Thread starter Thread starter Benign Vanilla
  • Start date Start date
B

Benign Vanilla

Working on an ASP.NET project recently, I was trying to put a customer
control into use, and kept receiving this error:

Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.

Parser Error Message: The directive 'Control' is unknown.

The web site that had the tutorial did not describe this error, and yet I
copied their code exactly. I searched the web and could not find a
definitive answer to this problem. Eventually, I found the cause of my
problem, so I thought I would post the solution here so 1) the experts could
validate my findings and 2) other newbs could possible stumble across this
post and save themselves some time.

The code I had copied was intended to be in a ASCX (a user control), whereas
I was using the code in an ASPX (a web form). In the web form, I simply
deleted the line:

<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="MyControl.ascx.vb"
Inherits="MyControl.MyControl"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

And this solved my problem. This directive is only used within a user
control, not a web form.

BV.
 
Yes, pasting incorrect code into a project may break it. There are many
other examples

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top