Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parser error when using ScriptManager

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;
like image 215
Serhat Ozgel Avatar asked Mar 31 '26 01:03

Serhat Ozgel


1 Answers

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)

like image 52
Jared Avatar answered Apr 02 '26 14:04

Jared



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!