UpdatePanel question

Last post 05-23-2006 5:25 PM by Luis Abreu. 1 replies.

Sort Posts:

  • UpdatePanel question

    05-23-2006, 7:27 AM
    • Member
      119 point Member
    • dooling
    • Member since 08-08-2005, 4:43 PM
    • Hangzhou
    • Posts 31
    I have a button to open a new window with code below
        public void OpenWindow(string redirect /* in */, string attributes /* in */)  
    {
    StringBuilder txtScript = new StringBuilder();
    txtScript.Append("<script language=javascript>\n");
    txtScript.Append(" window.open ('" + redirect + "',null , '" + attributes + " ');" + "\n");
    txtScript.Append("</script>");
    this.Page.RegisterStartupScript("MsgBox",txtScript.ToString());
    }

    protected void btnResult_Click(object sender, EventArgs e)
    {
    OpenWindow("reportresult.aspx", "");
    }
     
    but when I put it into updatepanel,it does not work.
    Hanzhou,China
    My Chinese Blog
  • Re: UpdatePanel question

    05-23-2006, 5:25 PM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 1:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • TrustedFriends-MVPs

    hello

    the problem is that atlas will only load the script nodes that have the type set to text/javascript. so, your best option is to remove the <script> elements from the string and use the following to register the jscript ion the page:

    this.Page.ClientScript.RegisterStartupScript( this.GetType(), "myKey", txtScript.ToString(), true );

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
Page 1 of 1 (2 items)