Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i know that i didn't describe the problem clearly but believe that i have no idea how should i explain it.

The button is rising the following event in parent page, but the javascript alert doesn't fire, do you have any idea?
ASP.NET
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:Button ID="btnContinue2" runat="server" OnClick="btnContinue2_Click"       Text="Button" />
    </ContentTemplate>
</asp:UpdatePanel>

i put a break point in the InsertLocationMap_MyEvent, so everything is fine until there but the alert box doesn't popup, is the reason that there is no postback ?

C#
protected void Page_Load(object sender, EventArgs e)
       {
           InsertLocationMap.MyEvent += InsertLocationMap_MyEvent;

       }

       void InsertLocationMap_MyEvent(object sender, usercontrols.cp_user.MyEventArgs e)
       {

           string javaScript = "<script language=JavaScript> alert('wwwoww'); </script>";
          System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "JCall2", javaScript, false);

       }
Posted
Comments
[no name] 9-Dec-12 3:17am    
On which control you're firing InsertLocationMap_MyEvent ??
Christ_88 9-Dec-12 3:24am    
in the child usercontrol the button (btnContinue2) fire the event but i pass it to parent page by eventhandler and the InsertLocationMap_MyEvent is called in parent page.
and i need call a javascript function in that. all these should happen without postback

string javaScript = "<script language="JavaScript"> alert('wwwoww'); </script>";
           System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "JCall2", javaScript, false);

Or you can also do the same by

System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "JCall2", "alert('Hello')", Yes);
 
Share this answer
 
v3
Comments
Christ_88 19-Dec-12 22:00pm    
thank you for the answer
Hi,

Check this url

http://www.codeproject.com/Questions/456037/Javascript-not-working-inside-Updatepanel
 
Share this answer
 
Comments
Christ_88 19-Dec-12 22:00pm    
thank you for the answer, that work for me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900