John
John

Reputation: 2141

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

Upvotes: 4

Views: 29145

Answers (8)

user3516686
user3516686

Reputation: 1

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.

Upvotes: 0

Alex Logvin
Alex Logvin

Reputation: 881

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 {...}
}

Upvotes: 1

Reza Faghani
Reza Faghani

Reputation: 161

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.

Upvotes: 0

Mahmoud Amini Arjmand
Mahmoud Amini Arjmand

Reputation: 79

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>

Upvotes: 0

Ortund
Ortund

Reputation: 8255

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)
    {
    }
}

Upvotes: 0

AnujDubey
AnujDubey

Reputation: 95

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 !!

Upvotes: 1

Jonathan S
Jonathan S

Reputation: 1

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.

Upvotes: 0

Abdul Aziz Kasem
Abdul Aziz Kasem

Reputation: 119

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.

Upvotes: 8

Related Questions