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;
1
  • What does your designer file look like for the page? Sounds like it's not liking the designer definition for the control. Commented Sep 18, 2008 at 17:28

2 Answers 2

5

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)

Sign up to request clarification or add additional context in comments.

Comments

1

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.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.