Solved

How do I get past "Cannot load type: keepsake.Categories1" error in user control file?

Posted on 2009-04-01
2
308 Views
Last Modified: 2013-12-26
I am trying to upgrade a 1.1 framework site to 2.0 because I do not have access to the 1.1 framework for recompiling the existing dll in the bin folder and I need to make changes to the ascx.vb file. When I rename the dll I get a Cannot load type error in the ascx file. the dll was named keepsake.dll. Is this the best way to approach the framework upgrade? Should there be a web.config entry for the user control? The 1.1 version of the site had the user control files (ascx and ascx.vb) in the document root folder. Can I leave them there or should I move them to a separate "controls" folder.

Please bear with me I am a .net newbie and have inherited a 1.1 site with no doc, etc. I am upgrading the site for the reasons stated in the previous paragraph.

Thank you!
Tim
Categories.ascx

--------------------
 

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

<font face="arial" size="2">

	<asp:Repeater ID="rptLinks" Runat="server">

		<ItemTemplate>

			<a href='quinceanera.aspx?cat_id=<%# DataBinder.Eval(Container.DataItem, "cat_id")%>'><%# DataBinder.Eval(Container.DataItem, "cat_name")%></a><br>

		</ItemTemplate>

		<FooterTemplate>

			<br>

		</FooterTemplate>

	</asp:Repeater>

</font>
 

Categories.ascx.vb

-----------------------

Imports System.Data.SqlClient
 
 

Namespace keepsake
 
 

    Partial Class Categories1

        Inherits System.Web.UI.UserControl
 

#Region " Web Form Designer Generated Code "
 

        'This call is required by the Web Form Designer.

        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
 

        End Sub
 
 

        Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

            'CODEGEN: This method call is required by the Web Form Designer

            'Do not modify it using the code editor.

            InitializeComponent()

        End Sub
 

#End Region
 

        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

            If (Not Page.IsPostBack) Then

                Dim objConn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))

                Dim objCommand As SqlCommand = New SqlCommand

                Dim objReader As SqlDataReader
 

                objCommand.CommandText = "SELECT * FROM Categories ORDER BY cat_name"
 

                objCommand.Connection = objConn
 

                objConn.Open()

                rptLinks.DataSource = objCommand.ExecuteReader

                rptLinks.DataBind()

                objConn.Close()
 

                objCommand.Dispose()

                objCommand = Nothing
 

                objConn.Dispose()

                objConn = Nothing

            End If

        End Sub
 

    End Class
 

End Namespace

Open in new window

0
Comment
Question by:bigmoxy
2 Comments
 
LVL 27

Accepted Solution

by:
nmarun earned 300 total points
ID: 24049764
Tim,
If you are using Visual Studio, VS will automatically upgrade your project files to .net 2.0 when you open the solution. If you do not want to move the controls into a UserControls folder, you need not, the application should work just fine.

Also, compiling a .net 1.1 application in a .net 2.0 framework should work just fine. Was the compilation failing back then?

One more thing, is 'keepsake' the root namespace? In other words, is this the web application itself?
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 200 total points
ID: 24050173
If you are upgrading to a Web Site model, where there is no project file, then the CodeBehind attribute needs to be changed to a CodeFile attribute, or you will get that error.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

759 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now