Type not compatible error

Posted on 2006-05-17
Last Modified: 2013-12-03
I get the error below on my IIS server but the code and pages work fine on my dev environment.

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The base class includes the field 'Derived_Moodys', but its type (System.Web.UI.WebControls.TextBox) is not compatible with the type of control (System.Web.UI.WebControls.DropDownList).

Source Error:

Line 248:                                                                                          <tr>
Line 249:                                                                                                <td class="reqField"><font style="FONT-WEIGHT: normal; FONT-SIZE: smaller; COLOR: #bf0f0f; FONT-STYLE: normal; FONT-FAMILY: Arial; FONT-VARIANT: normal">Moody's</font></td>
Line 250:                                                                                                <td><asp:DropDownList BorderWidth="1" BackColor="#ffffe1" BorderColor="#9696D9" BorderStyle="Inset" Runat="server" ID="Derived_Moodys" Width="125px"></asp:DropDownList>
Line 251:                                                                                                </td>
Line 252:                                                                                          </tr>

Source File: C:\Inetpub\wwwroot\CMO\Securitytwo.aspx    Line: 250
Question by:vmarria
    LVL 20

    Expert Comment

    do you have another Element in your Code with ID Derived_Moodys??
    LVL 3

    Expert Comment

    I've seen this type of error before when the control on the page doesn't match the declaration in codebehind -- i.e when I've changed a control from one type to another during development.

    is the control declared as a textbox in the codebehind file Securitytwo.aspx.cs or .vb and not a dropdownlist?

    Author Comment

    No there isn't any element in the code or code behind with the id of Derived_moodys.

    It was originally a text box but i've changed since then to a drop down list.

    I've done a find on the code behind to see if it got changed in the decleration and it has.

    There arn't any instances of derived_moods in the code behind in the decleration other then the drop down decleration.

    Could it be a compling issue. I've had problems where the code behind wasn't recognised properly on the server. Is there a way to "Complie" on the server?

    LVL 3

    Accepted Solution

    which version of .net are you using?

    after you changed the textbox to a dropdownlist and recompiled did you copy the latest .dll to the production web server's bin directory?

    Author Comment

    using versino .net 1.1

    you know what I didn't do that. <sigh>

    thank you i'll try that but i bet you thats what the problem is.

    Is there a way for it to complie on the server?
    LVL 3

    Expert Comment

    "Is there a way for it to complie on the server? "

    not in 1.1 unless you use the production server as your dev environment.
    typically you'd have a dev environment and then just fcopy the files required to run the site up to the production server.

    Author Comment

    I was being lazy to copy the entire project to the server from my home takes about an hour. So I was only copying the files that i modified i should have also just coppied the bin Directory also.


    I'll let you know if this works (i'm sure it will)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    761 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

    15 Experts available now in Live!

    Get 1:1 Help Now