473,387 Members | 1,476 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

asp.net 2.0 and a user control Parser Error

I'm having some major problems trying to get a user control working in
asp.net 2.0.

I have a user control in a sub directory of my project and I'm attempting to
put it on an aspx page. I'm getting an error like the following, though:

The base class includes the field 'MyUserControl', but its type
(Controls.MySubControls.MyUserControl) is not compatible with the type of
control (ASP.controls_mysubcontrols_myusercontrol_ascx).

The ascx is defined with:
<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="MyUserControl.ascx.cs"
Inherits="Controls.MySubControls.MyUserControl" %>
In the aspx, I reference the user control via something like:
<%@ Register TagPrefix="uc" TagName="MyUserControl"
Src="~/Controls/MySubControls/MyUserControl.ascx" %>

and later in the page via:
<uc:MyUserControl id="MyUserControl" runat="server" />
I'm stumped, so any help w/ this would be appreciated.

Thanks

Jim
Nov 2 '06 #1
1 2564
Nevermind... I was adding the ascx to a custom control.

The custom control markup went like:
<uc:MyControl>
<Title>My Title</Title>
<Body>
<uc:MyUserControl id="blah" runat="server" />
</Body>
</uc:MyControl>

The title and body properties for that custom control were PlaceHolders. So
that is why the type of the ascx was getting screwed up with asp.net.

To anyone reading this looking for a work around, you can either subclass a
Panel and make the Title part an attribute. Or you can change the title and
body properties to be ITemplate types.

Jim

"James Geurts" wrote:
I'm having some major problems trying to get a user control working in
asp.net 2.0.

I have a user control in a sub directory of my project and I'm attempting to
put it on an aspx page. I'm getting an error like the following, though:

The base class includes the field 'MyUserControl', but its type
(Controls.MySubControls.MyUserControl) is not compatible with the type of
control (ASP.controls_mysubcontrols_myusercontrol_ascx).

The ascx is defined with:
<%@ Control Language="C#" AutoEventWireup="true"
CodeFile="MyUserControl.ascx.cs"
Inherits="Controls.MySubControls.MyUserControl" %>
In the aspx, I reference the user control via something like:
<%@ Register TagPrefix="uc" TagName="MyUserControl"
Src="~/Controls/MySubControls/MyUserControl.ascx" %>

and later in the page via:
<uc:MyUserControl id="MyUserControl" runat="server" />
I'm stumped, so any help w/ this would be appreciated.

Thanks

Jim
Nov 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: mg | last post by:
Is there a way to reference a user control in one project from within another project? <%@ Register TagPrefix="HDR" TagName="WebUserControl1" Src="http://localhost/App2/WebUserControl1.ascx" %>...
1
by: mg | last post by:
I took the following steps to share a user control across applications but was unsuccessful. WebUserControl: <%@ Control Language="c#" AutoEventWireup="false" ClassName="WebUserControl1" %>...
2
by: Michael Carr | last post by:
Is it possible for a user control to contain instances of itself? i.e. for a TreeView-style control. When I try it, I get a Parser error: "Circular file references are not allowed." Thanks!!...
2
by: tshad | last post by:
This is related to my other Hiding datalistitems problem that I can't seem to solve. I have tried different methods which all seem to work only partially. I decided to try to use a User...
0
by: Tina Daniel | last post by:
I have an .ascx that gives this error: "Parser Error Message: 'OurCompanyID.ThisAppNamespace.Menu' is not a valid base class because it does not extend class 'System.Web.UI.Page'." I didn't...
0
by: Eachus | last post by:
Hello, I’m trying to create a web custom control. I’ve worked in asp.net extensively, but this is the first time I’ve attempted a web custom control. As a test, I created a control exactly...
1
by: saket | last post by:
hello frnd, in my project..my solution includes two webapplication projects. in webaplication1 i have created a user control...whn i m using that in webapplication2 webform...its showing error ...
8
by: mark.norgate | last post by:
I've run into a few problems trying to use generics for user controls (classes derived from UserControl). I'm using the Web Application model rather than the Web Site model. The first problem...
6
by: mast2as | last post by:
I have posted a few messages in the last few days about a project I am working on which is a quite simple parser. I ended up using the try/ catch structure as a general mechanism to control what's...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.