Solved

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

Posted on 2009-04-01
2
311 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

910 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

22 Experts available now in Live!

Get 1:1 Help Now