Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

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
?
320 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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 …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

721 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