views:

1785

answers:

3

I have an ASP.NET page which has a script manager on it.

<form id="form1" runat="server">
    <div>
        <asp:ScriptManager EnablePageMethods="true" ID="scriptManager2" runat="server">
        </asp:ScriptManager>
    </div>
</form>

The page overrides an abstract property to return the ScriptManager in order to enable the base page to use it:

public partial class ReportWebForm : ReportPageBase
{
    protected override ScriptManager ScriptManager
    {
        get { return scriptManager2; }
    }

    ...
}

And the base page:

public abstract class ReportPageBase : Page
{
    protected abstract ScriptManager ScriptManager { get; }

    ...
}

When I run the project, I get the following parser error:

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

How can I solve this?

Update: The script manager part of the designer file is:

protected global::System.Web.UI.ScriptManager scriptManager;
+3  A: 

I can compile your code sample fine, you should check your designer file to make sure everything is ok.

EDIT: the only other thing I can think of is that this is some sort of reference problem. Is your System.Web.Extensions reference using the correct version for your targeted framework? (should be 3.5.0.0 for .net 3.5 and 1.0.6xxx for 2.0)

Jared
+1  A: 

I found out that my referenced System.Web.Extensions (v3.5.sth) library did not have the same version with the reference in web.config (v.1.0.6sth). Replacing the dll (3.5) with the old version of System.Web.Extensions solved the problem.

Serhat Özgel
ha! we must have been typing this at the same time! Congrats on solving your problem!
Jared