Ambiguous match found: Error in ASP.Net Application

Some time it’s very hard to figure out whats exactly going wrong when we get Error “Ambiguous match found”.
Because this issue you will seen when you publish code on server even your development code working fine and see you proper output.

Error

I face this problem today and after a lot of googling I figure out the best way to overcome this issue is that,
When you work with a Asp.net website project then very first you need to convert it in Web Application Project

How to convert Web Site to Web Application project

After that follow the following Steps –

1. Select your page on which you are getting Ambiguous match found issue.
2. Right Click and Select “Convert to Web Application”

Option

as soon as you select this, it will display the actual error. Most of the time this issue happen because of control id conflict with variable name on server site.

[Interview Question] What is the Timer control in ASP.NET Ajax?

The Ajax Timer control is a server control that embeds a JavaScript component into the Web page. Then the JavaScript component initiates the postback from the browser when the interval that is defined in the Time Interval property has elapsed.

Time control always used with ScriptManager class that means an instance of ScriptManager class me be include in web page before add Timer control.
When Timer control initiates the postback, it rails the Tick event on the server. You can use it by creating an event handler on server to perform action periodically.

Scenarios:

Case1: If you want to refresh your web page or a part of web page at a timed interval then we can use Ajax Timer Control.

Case2: In case of refresh only a part of web page Ajax Timer Control use with ScriptManager and UpdatePanel control.

Case 1. Refresh Complete Page

Step 1: Add ScriptManager Control in your design page. You will find it at ToolBox –> Ajax Extensions Tab.

<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>

Step 2. Add timer control in your design page. You will find Time control in your ToolBox –> Ajax Extensions Tab.

<asp:Timer ID="Timer1" runat="server" 
            Interval="10000" ontick="Timer1_Tick">
</asp:Timer>

Interval=”10000″

Here we have setup Interval property of Timer is “10000” means page will be refreshed in every 10 seconds because Interval property is defined in milliseconds.

ontick=”Timer1_Tick”

This event we will use to add business logic which will refreshed at every 10 seconds.

Step 3. Add your Business Logic which you want to update after a time interval at Timer Tick event in Server page

protected void Timer1_Tick(object sender, EventArgs e)
        {
// Place your business logic here which will 
// refresh after the given time interval
 
}

Case 2. Refresh a part of web page

This is the most common scenario in which we use Timer control.

We can easily understand this case with the help of following example.

If we want to print the Current date time on a label in page and update it with real time change then we can use Timer control to achieve this.

In this scenario Timer control will be used with ScriptManager control, the UpdatePanel control.

Step 1: Add ScriptManager Control in your design page. You will find it at ToolBox –> Ajax Extensions Tab.

<asp:ScriptManager ID="ScriptManager11" runat="server">
    </asp:ScriptManager>

Step 2: Add UpdatePanel Control in your design page. You will find it at ToolBox –> Ajax Extensions Tab.

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    </asp:UpdatePanel>

Step 3: Add Timer Control within UpdatePanel.

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Timer ID="Timer1" runat="server" Interval="10000" 
                   ontick="Timer1_Tick">
            </asp:Timer>
        </ContentTemplate>
</asp:UpdatePanel>

I have already explained Interval property and ontick event above in details.

Step 4: Add Label within UpdatePanel.

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Timer ID="Timer1" runat="server" 
                      Interval="10000" ontick="Timer1_Tick">
            </asp:Timer>
            <asp:Label ID="MyLabel" runat="server" 
                      Text="This Panel Still not refreshed.">
            </asp:Label>
        </ContentTemplate>
    </asp:UpdatePanel>

Here we have set the default text of label is “This Panel Still not refreshed”. So that we can easily verify when panel start to refresh at every 10 seconds.

Step 5: Add your Business Logic which you want to update after a time interval at Timer Tick event in Server page

protected void Timer1_Tick(object sender, EventArgs e)
        {
// Place your business logic here which will refresh after the given time interval
MyLabel.Text = "Panel refreshed at: " + DateTime.Now.ToLongTimeString();
}

Now save your project and press ctrl+f5 to run it and wait at least 10 second to see the panel to refresh. And you will see that the text of label changed at every 10 seconds without reload the complete page.

[Interview Question] What is a ScriptManager in ASP.NET AJAX?

What is a ScriptManager in ASP.NET AJAX?

In order to use AJAX functionality on a web page it is required to add a ScriptManager control to the page. ScriptManager control register Microsoft Ajax Library scripts to the web page so we should use the one ScriptManager per page. ScriptManager control enables script to use the type system extensions and to support features like partial-page rendering. Continue reading “[Interview Question] What is a ScriptManager in ASP.NET AJAX?”

[Interview quiz] What is the Ajax UpdatePanel

what is the Update panel in asp.net?

Just the Answer

The ASP.NET UpdatePanel control enables you to add AJAX functionality in to the web page. It can be used to update the selected parts of the page instead of refreshing the whole page with a postback. You can say that we can perform the Partial-page rendering using the UpdatePanel control in ASP.Net. Continue reading “[Interview quiz] What is the Ajax UpdatePanel”

Writing and reading cookies in ASP.net using c#

A cookie is just a little bit of text which is send by the browser each time with the request for the page. Each time on the machine when browser will make the request to the web page, it will send the existing cookies along with the request too. So this approach helping the Web site or web application remember users and other information such as user’s preferences, shopping cart contents and the user’s session. Continue reading “Writing and reading cookies in ASP.net using c#”

JQuery multiple files upload in asp.net and C# using Ajax form

In this article we will discuss about the files uploading in the asp.net. Asp.net provides the FileUpload control and you can use this with a small amount of code lines for uploading the documents. However there are many other ways to upload the files using the several jQuery,flash and Ajax plugins. In the following you can see a such a script that use the Ajax form plugin. Continue reading “JQuery multiple files upload in asp.net and C# using Ajax form”

Create user control for the footer of the your web application in asp.net

With the help of the following tutorial, you can create a user control for the footer of your web application. The article demonstrates how you can create a user control and how can you use that. In this article code is written using Visual Studio 2008. So first you need to add a web user control in your project, just follow these instructions: Continue reading “Create user control for the footer of the your web application in asp.net”