Solved

ajax asp.net error

Posted on 2010-11-18
17
1,566 Views
Last Modified: 2012-06-21
What could be the reason for the below  error..please help ..very urgent

The control with ID 'ConfirmButtonExtender1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The control with ID 'ConfirmButtonExtender1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
0
Comment
Question by:STEVE00098
  • 7
  • 6
  • 2
  • +1
17 Comments
 
LVL 18

Expert Comment

by:Gary Davis
ID: 34169941
Check the master page, if any.

Gary
0
 

Author Comment

by:STEVE00098
ID: 34169944
how to check master page
0
 
LVL 18

Expert Comment

by:Gary Davis
ID: 34169960
If you have a master page, is there a possibility that it needs the script manager? It's just something to consider and easy to forget about that dependency.
0
 
LVL 20

Expert Comment

by:ddayx10
ID: 34169963
You are trying to use an ajax extender control but the page is not detecting a scriptmanager. On the page just inside the <form> tag you need to use something like this:
<asp:ScriptManager ID="sm" runat="server" />

If you are using a MasterPage (I have no way to know if you are) then you would put the above on the masterpage, still just inside the form, and you may need to add a scriptmanagerproxy to the .aspx page thus:
<asp:ScriptManagerProxy ID="smp" runat="server" />
0
 

Author Comment

by:STEVE00098
ID: 34169995
Thank you all for the assistance

 <form id="form1" runat="server">
       
        <asp:ScriptManager ID="sm" runat="server" />
        <asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" ConfirmText="ok">
       
        </asp:ConfirmButtonExtender>
       
       
    </form>
</body>


Now this error

The TargetControlID of 'ConfirmButtonExtender1' is not valid. The value cannot be null or empty.
0
 
LVL 21

Expert Comment

by:Alfred1
ID: 34170007
You can just drag a Script Manager control from the toolbox to the Master Page if you want.  Or, you could just type it as well.  You need to put this Script Manager Control as the first control item in your Master Page.  Something like in the code below:
<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="Site1.master.vb" Inherits="Test.Test1" %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

    <title>Test</title>

    <asp:ContentPlaceHolder ID="head" runat="server">

    </asp:ContentPlaceHolder>

</head>

<body>

    <form id="form1" runat="server">

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

    </asp:ScriptManager>



    <!-- Everything else after script manager -->



    </form>

</body>

</html>

Open in new window

0
 
LVL 21

Expert Comment

by:Alfred1
ID: 34170019
You need to provide the TargetControlID which is the ID of the control (button or link usually) for this extender to operate on.

Check the ConfirmButton Demonstration in this link:

http://www.asp.net/ajax/ajaxcontroltoolkit/samples/ConfirmButton/ConfirmButton.aspx
0
 
LVL 20

Expert Comment

by:ddayx10
ID: 34170041
You need a button on the page to confirm whether an action should take place (likely postback). Sample usage of all issues you mention:


<form id="form1" runat="server">

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

	<asp:Button ID="Btn" runat="server" Text="Confirm Me" />

	<cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="Btn" ConfirmText="Are You Sure?">

	</cc1:ConfirmButtonExtender>

    </form>

Open in new window

0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:STEVE00098
ID: 34170064
I was able to display the page with out any issues, but when i click the button I get this error message.


Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB6.6; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; InfoPath.2; BRI/1; .NET4.0C; .NET4.0E)
Timestamp: Fri, 19 Nov 2010 02:30:13 UTC


Message: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll.
Line: 19
Char: 5
Code: 0
URI: http://localhost:50439/WebSites/ScriptResource.axd?d=p9YF5iPLsQD8mOYNrJmFZ3zhqOFFgSdrJQdcZDZzAjKc9plPGatbCpBmLxxfitnfh-aLfOfiUXKL0S4IkVfBzQ2&t=11e6618b


Message: Sys.ArgumentUndefinedException: Value cannot be undefined.
Parameter name: baseType
Line: 1718
Char: 71
Code: 0
URI: http://localhost:50439/WebSites/ScriptResource.axd?d=eQOeuK3I9V5txqY6fvjZpQPkPjjQT41fEp5cvWcExIQHxYGJ0P1ggnpZ9SeNr09ZD3V_jmS2UuPl_F9Ut7dGmqdJEq3ftjWey7xxxiEsVao1&t=ffffffffec2d9970


Message: Sys.ArgumentException:  does not derive from Sys.Component.
Parameter name: type
Line: 2707
Char: 9
Code: 0
URI: http://localhost:50439/WebSites/ScriptResource.axd?d=eQOeuK3I9V5txqY6fvjZpQPkPjjQT41fEp5cvWcExIQHxYGJ0P1ggnpZ9SeNr09ZD3V_jmS2UuPl_F9Ut7dGmqdJEq3ftjWey7xxxiEsVao1&t=ffffffffec2d9970

0
 
LVL 20

Expert Comment

by:ddayx10
ID: 34170084
Well you can try putting this registration at the top of your page at line 2 (from your previous example):
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

And this in place of the scriptmanager:
<cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="Btn" ConfirmText="Are You Sure?"></cc1:ConfirmButtonExtender>

Not real sure why it's forcing you to do that.
0
 
LVL 20

Expert Comment

by:ddayx10
ID: 34170092
Sorry pasted the wrong thing!

Well you can try putting this registration at the top of your page at line 2 (from your previous example):
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

And this in place of the scriptmanager:
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
0
 

Author Comment

by:STEVE00098
ID: 34170104
Code didn't work

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Create Category.aspx.vb"
Inherits="Create_Category" %>


 <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        &nbsp;<asp:Button ID="Button1" runat="server" Text="Button" />
       
               
        <asp:cc1.ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="Button1" ConfirmText="Are you sure you want to click this?"    OnClientCancel="CancelClick">
        </asp:cc1.ConfirmButtonExtender>
       
    </form>
</body>
</html>
0
 
LVL 20

Accepted Solution

by:
ddayx10 earned 500 total points
ID: 34170125
You didnt see my correction before. I made a mistake sorry. Updated what you posted below.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Create Category.aspx.vb" 

Inherits="Create_Category" %>



<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>Untitled Page</title>

</head>

<body>

    <form id="form1" runat="server">

		<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></cc1:ToolkitScriptManager>

        <asp:Button ID="Button1" runat="server" Text="Button" />

        <cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="Button1" ConfirmText="Are you sure you want to click this?">

        </cc1:ConfirmButtonExtender>

    </form>



</body>

</html>

Open in new window

0
 

Author Comment

by:STEVE00098
ID: 34170140
You guys are awesome..Thank you ddayx10:...
0
 
LVL 20

Expert Comment

by:ddayx10
ID: 34170147
YW :)
0
 

Author Comment

by:STEVE00098
ID: 34170226
when I use something like this for pop up control, i get this error message
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Button ID="Button1" runat="server" Text="Create category" />
    <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></cc1:ToolkitScriptManager>
    <cc1:ModalPopupExtender ID="MPE" runat="server"    TargetControlID="Button1"    PopupControlID="Panel1"    BackgroundCssClass="modalBackground"     DropShadow="true"     OkControlID="OkButton"     OnOkScript="onOk()"    CancelControlID="CancelButton"     PopupDragHandleControlID="Panel3" />
   

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB6.6; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; InfoPath.2; BRI/1; .NET4.0C; .NET4.0E)
Timestamp: Fri, 19 Nov 2010 03:20:30 UTC


Message: '_popupElement.parentNode' is null or not an object
Line: 37
Char: 1892
Code: 0
URI: http://localhost:50439/WebSites/Home.aspx?_TSM_HiddenField_=ToolkitScriptManager1_HiddenField&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d3.5.40412.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3a1547e793-5b7e-48fe-8490-03a375b13a33%3ade1feab2%3af9cec9bc%3aa67c2700%3af2c8e708%3a8613aea7%3a3202a5a2%3aab09e3fe%3a87104b7c%3abe6fb298

 
0
 
LVL 20

Expert Comment

by:ddayx10
ID: 34170561
Wow. Are you trying to learn the AjaxControlToolkit in one night :)?

Now you are trying to use the modalpopupextender. This requires:
1) An element you want to hide - I'll use a panel.
2) An element that causes #1 to display - I'll use a button.
3&4) Elements causing the process to continue or cancel - I'll use buttons inside the panel (#1)

The idea is you use the extender and you have to give it the IDs of these various elements as its properties. When setup properly you are able to cause a modal to popup and display a message or give an option, etc.

Below is the proper setup of a sample of this code :)

I'm tired, going to bed. Just luck I noticed this after it was closed, but since you were so prompt on points I figured the least I could do was help you out a little further.

This is a great site for learning how to use the AjaxControlToolkit components. It shows each one in action, what it does, how to set it up, has tutorials etc at the top:
http://www.asp.net/ajax/ajaxcontroltoolkit/samples/
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>Untitled Page</title>

</head>

<body>

    <form id="form1" runat="server">

	<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">

	</cc1:ToolkitScriptManager>

			<asp:Button ID="BtnFire" runat="server" Text="Fire Modal" />

			<asp:Label ID="LbSelectedText" runat="server" />

			<asp:Panel ID="PnlModal" runat="server">

				<h3>Some Message</h3>

				<p>Press OK to postback, or Cancel. Either will close this modal.</p>

				<div>

					<asp:Button ID="BtnOK" runat="server" Text="OK" />

					<asp:Button ID="BtnCnl" runat="server" Text="Cancel" />

				</div>

			</asp:Panel>

			<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server"

				TargetControlID="BtnFire"

				PopupControlID="PnlModal"

				CancelControlID="BtnCnl"

				OkControlID="BtnOK">

			</cc1:ModalPopupExtender>   

	</form>

</body>

</html>

Open in new window

0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Several part series to implement Internet Explorer 11 Enterprise Mode
Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
How to install and configure Citrix XenApp 6.5 - Part 1. In this video tutorial we have explained step by step installation of Citrix XenApp 6.5 Server on Windows Server 2008 R2 is explained in this video. We have explained the difference between…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now