By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,723 Members | 844 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,723 IT Pros & Developers. It's quick & easy.

The directive 'Control' is unknown.

P: n/a
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.
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Yes, pasting incorrect code into a project may break it. There are many
other examples

Jeff
"Benign Vanilla" <BV************@tibetanbeefgarden.com> wrote in message
news:2v*************@uni-berlin.de...
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.

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.