简体   繁体   中英

Parser Error Message: Ambiguous match found

Im running a web application in visual studio 2008.. i got this error when particular page was loaded.. help me to proceed.... Thank u.....

Server Error in '/PSS.NET' Application.
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: Ambiguous match found.

Source Error:

<%@ Register TagPrefix="uc1" TagName="CtrlButtonControl" Src="../../WebControls/CtrlButtonControl.ascx" %>  
<%@ Page language="c#" Codebehind="SPSearchFromToDtStorLocMatTypRank.aspx.cs" AutoEventWireup="false" Inherits="Sdi.Pss.Reports.SP.SPSearchFromToDtStorLocMatTypRank" %>  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

Source File: /PSS.NET/Reports/SP/SPSearchFromToDtStorLocMatTypRank.aspx Line: 1

Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3614

I've the same problem and it solved and the solution is in check your code behind and you will find a couple of Controls with the same name:

protected Button Home;

protected System.Web.UI.HtmlControls.HtmlAnchor home; 

you have to erase one line or comment it.

thanks a lot.

In my case the two controls were in different files, one in the .aspx page (StartDate) and one in the code behind file (startDate). Compiler didn't catch it because they're both partial classes. Added an underscore to startDate to resolve it.

recently I faced a similar issue where I had duplicate names but in different cases. Solution was compiled successfully but i was facing the issue in one of the .aspx page with Ambiguous code found error.

i resolved it using- 1. Go to the .aspx page in the solution and right click 2. click on "check accessibility" , a dialog box will open, check all and click ok 3. now in the lower pane (where we see all the errors) there will be warning mentioning the causing control/name which is causing this ambiguity.

Hope it helps !!

I got the same error when I had 2 fields declared in my class in my class:

public partial class Page : System.Web.UI.Page
{
    private string headerText;
    private string resultText;

    protected void Page_Load(object sender, EventArgs e)
    {
    }
}

This caused the error so I just changed those strings to properties which fixed the problem:

public partial class Page : System.Web.UI.Page
{
    private string HeaderText { get; set; }
    private string ResultText { get; set; }

    protected void Page_Load(object sender, EventArgs e)
    {
    }
}

This error might be caused by many factors. For instance, in my entity class property in base entity and driven class made this error cause they have the same name and compiler get confused! So take a look at your code carefully to check any signs of mistyping or naming violation.

maybe you have two controlls with same name in two different ContentPlaceHolder. simular ids are possible only with case sensitive differense. for example btnSave and btnsave.

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   <asp:Button ID="btnSave" runat="server" />
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
    <asp:Button ID="btnsave" runat="server" />
</asp:Content>

Had the same problem. Check in you YourPage.aspx.designer.cs if there is a namespace declaration like this below wrapping the page class

namespace YourProject.Stuff.Stuff
{
    public partial class YourPage {...}
}

In my case, it was because : I created an empty project. Then add a web form. Got that error. We should check the box WebForm when we create a web form project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM