Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2009-04-01
2
Medium Priority
?
321 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 900 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 600 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…
Suggested Courses

885 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