Link to home
Start Free TrialLog in
Avatar of STEVE00098
STEVE00098

asked on

ajax asp.net error

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.  
Avatar of Gary Davis
Gary Davis
Flag of United States of America image

Check the master page, if any.

Gary
Avatar of STEVE00098
STEVE00098

ASKER

how to check master page
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.
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" />
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.
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

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

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

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.
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">
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>
ASKER CERTIFIED SOLUTION
Avatar of Member_2_4913559
Member_2_4913559
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You guys are awesome..Thank you ddayx10:...
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

 
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