.NETGURU
can not load type 'user control'
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngreuse' list.


Stewart Haddock
I just created a user control in vs.net, but when I build and browse, I get an error that it can not find the namespace in the code behind file. Specifically..."Could not load type 'AlphaBrackets.siteadmin.SiteAdminHeader'."

Any ideas?

Thanks

Stewart
Reply to this message...
 
    
Daniel Naumann
I just created a user control in vs.net, but when I build and browse, I get an error that it can not find the namespace in the code behind file. Specifically..."Could not load type 'AlphaBrackets.siteadmin.SiteAdminHeader'."

Any ideas?

Thanks

Stewart
Reply to this message...
 
    
Stewart Haddock
Sure.

The first section is the .ascx file and the second section is the .ascx.cs
file. The error is:"Could not load type
'AlphaBrackets.siteadmin.SiteAdminHeader'." with the first line of the
.ascx file highlighted red.

.ascx
------------
<@ Control Language="c#" AutoEventWireup="false"
Codebehind="SiteAdminHeader.ascx.cs"
Inherits="AlphaBrackets.siteadmin.SiteAdminHeader"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5";%>
<asp:Repeater id="AdminLinks" runat="server">
<ItemTemplate>
<%#((DictionaryEntry)Container.DataItem).Key%>
:
<%#((DictionaryEntry)Container.DataItem).Value%>
</ItemTemplate>
</asp:Repeater>
------------

.ascx.cs
------------
------------

using System;

using System.Collections;

using System.Web.UI;

namespace AlphaBrackets.siteadmin

{

/// <summary>

/// Summary description for SiteAdminHeader.

/// </summary>

public abstract class SiteAdminHeader : System.Web.UI.UserControl

{

protected System.Web.UI.WebControls.Repeater AdminLinks;

private void Page_Load(object sender, System.EventArgs e)

{

//if not post back we will set up the links.

if(!IsPostBack)

{

Hashtable h = new Hashtable();

h.Add ("key1", "value1");

h.Add ("key2", "value2");

h.Add ("key3", "value3");

AdminLinks.DataSource = h;

AdminLinks.DataBind();

}

}

}

}

Thanks!

Stewart

----- Original Message -----
From: "Daniel Naumann" <Click here to reveal e-mail address>
To: "aspngreuse" <Click here to reveal e-mail address>
Sent: Wednesday, May 29, 2002 9:49 PM
Subject: [aspngreuse] RE: can not load type 'user control'

[Original message clipped]

Reply to this message...
 
    
Daniel Naumann
Hmmmm, well it all looks pretty good to me. The only thing I can see, and this
may just be a typo, is that in your ascx file you have "<@ Control
language.......... %>". I think you need a "%" in between the first "<" and
"@". Other than that I admit I'm a bit lost.

You said you use the "build and browse". is that the build and browse from the
right mouse click option? If so, I've had trouble with that i the past. I
usually just build it then select "view in browser".

Sorry i haven't been much help, maybe some else will do better.

Daniel.

-----Original Message-----
From: Stewart Haddock [mailto:Click here to reveal e-mail address]
Sent: 30-May-2002 07:55
To: aspngreuse
Subject: [aspngreuse] RE: can not load type 'user control'

Sure.

The first section is the .ascx file and the second section is the .ascx.cs
file. The error is:"Could not load type
'AlphaBrackets.siteadmin.SiteAdminHeader'." with the first line of the
.ascx file highlighted red.

.ascx
------------
<@ Control Language="c#" AutoEventWireup="false"
Codebehind="SiteAdminHeader.ascx.cs"
Inherits="AlphaBrackets.siteadmin.SiteAdminHeader"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5";%>
<asp:Repeater id="AdminLinks" runat="server">
<ItemTemplate>
<%#((DictionaryEntry)Container.DataItem).Key%>
:
<%#((DictionaryEntry)Container.DataItem).Value%>
</ItemTemplate>
</asp:Repeater>
------------

.ascx.cs
------------
------------

using System;

using System.Collections;

using System.Web.UI;

namespace AlphaBrackets.siteadmin

{

/// <summary>

/// Summary description for SiteAdminHeader.

/// </summary>

public abstract class SiteAdminHeader : System.Web.UI.UserControl

{

protected System.Web.UI.WebControls.Repeater AdminLinks;

private void Page_Load(object sender, System.EventArgs e)

{

//if not post back we will set up the links.

if(!IsPostBack)

{

Hashtable h = new Hashtable();

h.Add ("key1", "value1");

h.Add ("key2", "value2");

h.Add ("key3", "value3");

AdminLinks.DataSource = h;

AdminLinks.DataBind();

}

}

}

}

Thanks!

Stewart

----- Original Message -----
From: "Daniel Naumann" <Click here to reveal e-mail address>
To: "aspngreuse" <Click here to reveal e-mail address>
Sent: Wednesday, May 29, 2002 9:49 PM
Subject: [aspngreuse] RE: can not load type 'user control'

[Original message clipped]

| http://www.aspfriends.com/aspfriends/aspngreuse.asp = JOIN/QUIT
</BODY></HTML>
[Original message clipped]

Reply to this message...
 
    
Stewart Haddock
Well, who knows what was wrong.

I just deleted the whole user control and started over. The new one works
perfectly! Weird...

Thanks Daniel
Stewart
----- Original Message -----
From: "Daniel Naumann" <Click here to reveal e-mail address>
To: "aspngreuse" <Click here to reveal e-mail address>
Sent: Thursday, May 30, 2002 6:10 PM
Subject: [aspngreuse] RE: can not load type 'user control'

> Hmmmm, well it all looks pretty good to me. The only thing I can see, and
this
[Original message clipped]

Reply to this message...
 
 
System.Collections.DictionaryEntry
System.Collections.Hashtable
System.ComponentModel.Container
System.EventArgs
System.Web.UI.UserControl
System.Web.UI.WebControls.Repeater




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification