We help IT Professionals succeed at work.
Get Started

objectdatasource error typename cannot be found

-Dman100-
-Dman100- asked
on
1,298 Views
Last Modified: 2012-06-27
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.

Thanks.
<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">
            <Columns>
                <asp:BoundField DataField="JobTitle" HeaderText="JobTitle" 
                    SortExpression="JobTitle" />
                <asp:TemplateField HeaderText="Category" SortExpression="CategoryID">
                    <EditItemTemplate>
                        <asp:DropDownList ID="DropDownList1" runat="server" 
                             DataSourceID="ObjectDataSource2" DataTextField="CategoryName" 
                            DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>'>
                        </asp:DropDownList>
                        <asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
                            SelectMethod="GetCategories" TypeName="ADPLibrary.BLL.JobCategoriesBLL"></asp:ObjectDataSource>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("CategoryName") %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="URL" SortExpression="URL">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("URL") %>' Width="1050px"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("URL") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="City" HeaderText="City" SortExpression="City">
                    <ControlStyle Width="100px" />
                </asp:BoundField>
                <asp:BoundField DataField="State" HeaderText="State" SortExpression="State">
                    <ControlStyle Width="20px" />
                <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>
                
                <asp:BoundField DataField="Country" HeaderText="Country" SortExpression="Country">
                    <ControlStyle Width="20px" />
                <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
            </Columns>
        </asp:GridView>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            DeleteMethod="DeleteJob" 
            SelectMethod="GetJobs" TypeName="ADPLibrary.BLL.JobBLL" 
            UpdateMethod="UpdateJob">
            <DeleteParameters>
                <asp:Parameter Name="jobID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <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" />
            </UpdateParameters>
        </asp:ObjectDataSource>


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

Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE