views:

16

answers:

0

Hi.... I have a master page which has a timer control with an asynchronous postback trigger. I need to display a popup window everytime when the timer is triggered. How I can achieve this using client script.... I tried via., Response.Write and thru Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", " alert('test popup');"); response.write working fine when page is loaded for the first time. When I use ClientScript it is showing the following server error as

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 'TimePanel' 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.

Stack Trace:

[InvalidOperationException: The control with ID 'TimePanel' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.] System.Web.UI.UpdatePanel.get_ScriptManager() +280 System.Web.UI.UpdatePanel.RegisterPanel() +156 System.Web.UI.UpdatePanel.OnInit(EventArgs e) +45 System.Web.UI.Control.InitRecursive(Control namingContainer) +565 System.Web.UI.Control.InitRecursive(Control namingContainer) +319 System.Web.UI.Control.InitRecursive(Control namingContainer) +319 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2065

Below I have attached the code....

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

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

 <asp:UpdatePanel ID="TimePanel" runat="server"> 
                             <Triggers>                             
                        <asp:AsyncPostBackTrigger ControlID="AlertTimer" EventName="Tick" /> 
                    </Triggers> 
                </asp:UpdatePanel> 

 <asp:Timer ID="AlertTimer" runat="server" EnableViewState="false" 
  Interval="60000" ontick="AlertTimer_Tick"/> 


</form>

//default.aspx.cs

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Collections.Generic; using System.Linq;

public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //Response.Write(""); //Response.Write("alert(\"Error Message\");"); //Response.Write("");

    //Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "<script language=javascript> alert('test popup');</script>");

}
protected void AlertTimer_Tick(object sender, EventArgs e)
{
    Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", "<script language=javascript> alert('test popup');</script>");
} 

}

and in web.config in controls under pages i hav added this....

    <add tagPrefix="cc1" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 

I don't find suitable solution for this. pls help asap... thanx :)