We help IT Professionals succeed at work.

objectdatasource error typename cannot be found

-Dman100- asked
I have a dropdown list that I'm binding to an objectdatasource within a edit template of a gridview.  Everything works perfectly fine on our staging server, but when I view on our production server I get the following error:

"The type specified in the TypeName property of the ObjectDataSource 'ObjectDataSource2' could not be found."

The typename is correct.  It works on our staging server.  What would cause this to not work on our production server?  Any way to re-write the code to get this to work?

See the code below.

<asp:HyperLink runat="server" ID="lnkAddJob" Text="Add New ADP Job Listing" NavigateUrl="~/ADPJobListingOp.aspx"></asp:HyperLink>
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AutoGenerateColumns="False" DataKeyNames="JobID" 
            DataSourceID="ObjectDataSource1" OnRowDataBound="GridView1_RowDataBound">
                <asp:BoundField DataField="JobTitle" HeaderText="JobTitle" 
                    SortExpression="JobTitle" />
                <asp:TemplateField HeaderText="Category" SortExpression="CategoryID">
                        <asp:DropDownList ID="DropDownList1" runat="server" 
                             DataSourceID="ObjectDataSource2" DataTextField="CategoryName" 
                            DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>'>
                        <asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
                            SelectMethod="GetCategories" TypeName="ADPLibrary.BLL.JobCategoriesBLL"></asp:ObjectDataSource>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("CategoryName") %>'></asp:Label>
                    <ItemStyle HorizontalAlign="Center" />
                <asp:TemplateField HeaderText="URL" SortExpression="URL">
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("URL") %>' Width="1050px"></asp:TextBox>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("URL") %>'></asp:Label>
                <asp:BoundField DataField="City" HeaderText="City" SortExpression="City">
                    <ControlStyle Width="100px" />
                <asp:BoundField DataField="State" HeaderText="State" SortExpression="State">
                    <ControlStyle Width="20px" />
                <ItemStyle HorizontalAlign="Center" />
                <asp:BoundField DataField="Country" HeaderText="Country" SortExpression="Country">
                    <ControlStyle Width="20px" />
                <ItemStyle HorizontalAlign="Center" />
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            SelectMethod="GetJobs" TypeName="ADPLibrary.BLL.JobBLL" 
                <asp:Parameter Name="jobID" Type="Int32" />
                <asp:Parameter Name="categoryID" Type="Int32" />
                <asp:Parameter Name="jobTitle" Type="String" />
                <asp:Parameter Name="url" Type="String" />
                <asp:Parameter Name="city" Type="String" />
                <asp:Parameter Name="state" Type="String" />
                <asp:Parameter Name="country" Type="String" />
                <asp:Parameter Name="jobID" Type="Int32" />

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data;
using ADPLibrary.DAL;
using ADPLibrary.BLL;

public partial class Controls_ADPJobListingManager : System.Web.UI.UserControl
    protected void Page_Load(object sender, EventArgs e)

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        if (e.Row.RowType == DataControlRowType.DataRow)
            LinkButton lb = (LinkButton)e.Row.Cells[6].Controls[2];

            if (lb.Text.ToLower() == "delete")

                ADP.JobsRow job = (ADP.JobsRow)((DataRowView)e.Row.DataItem).Row;

                lb.OnClientClick = string.Format("return confirm('Are you certain you want to delete {0} job listing?');", job.JobTitle.Replace("'", @"\'"));

Open in new window

Watch Question

I believe some time ago there was a similar issue with Production/Dev app. It turned out that the GAC had an older version of the assembly that was being loaded because of non-fully qualified typenames
Can you please try by
- Cleaning the GAC on production machine
- Use fully qualified typenames in code (assembly name, version, pubilc key token)
-Dman100-Software Consultant


How do I clearn the GAC on our production server?

Is there an example of creating the fully qualified typenames in code? i.e. assembly name, version, public key token.

What is the public key token?
System.Web.Security.SqlMembershipProvider, System.Web, Version=, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a
The above is an example of a fully qualified typename. It consists of five parts
System.Web.Security.SqlMembershipProvider // fully qualified typename in assembly i.e. all namespaces,

System.Web // Name of the dll/exe,
Version= // This the version of assembly, normally specified in project settings or auto incremented on build,
Culture=neutral // If a particular culture is set otherwise neutral,
PublicKeyToken=b03f5f7f11d50a3a // If the assembly is signed, otherwise null
 To find the public key token  you can use the info on this link