Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Trying to redirect the parent page from popup

Trying to redirect the parent page from popup

Scheduled Pinned Locked Moved ASP.NET
javascripttoolsquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Ekjon
    wrote on last edited by
    #1

    Hi, I have this popup page where i am doing this in the button click: Response.Write("<script language='javascript'>function changeParent(){window.opener.document.getElementById('ctl00$ContentPlaceHolder1$txtChange').value='Change';}window.close();</script>"); In the parent form I have a hidden textbox set to autopostback=true and in the textchanged event handler, I am doing response.redirect(url). In the script above(in the popup), I am changing the value of the textbox located in the parent page. So, I was expecting it to work, but its not. Any idea? Thanks.

    T 1 Reply Last reply
    0
    • E Ekjon

      Hi, I have this popup page where i am doing this in the button click: Response.Write("<script language='javascript'>function changeParent(){window.opener.document.getElementById('ctl00$ContentPlaceHolder1$txtChange').value='Change';}window.close();</script>"); In the parent form I have a hidden textbox set to autopostback=true and in the textchanged event handler, I am doing response.redirect(url). In the script above(in the popup), I am changing the value of the textbox located in the parent page. So, I was expecting it to work, but its not. Any idea? Thanks.

      T Offline
      T Offline
      TylerBrinks
      wrote on last edited by
      #2

      You can call the function __doPostback event in the parent window. Take a look at the parent's source and see what script the hidden field is invoking (in case it's not the default __doPostback). Add that code to your popup window script.

      E 1 Reply Last reply
      0
      • T TylerBrinks

        You can call the function __doPostback event in the parent window. Take a look at the parent's source and see what script the hidden field is invoking (in case it's not the default __doPostback). Add that code to your popup window script.

        E Offline
        E Offline
        Ekjon
        wrote on last edited by
        #3

        I've found this in the parent's source: onchange="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$txtChange\',\'\')', 0)" But what would be the syntax to call this from the popup window script? Do I call it after changing the value? like: Response.Write("<script language='javascript'>function changeParent(){window.opener.document.getElementById('ctl00$ContentPlaceHolder1$txtChange').value='Change'; __doPostBack(\'ctl00$ContentPlaceHolder1$txtChange\',\'\')', 0); }window.close();</script>"); Thanks.

        T 1 Reply Last reply
        0
        • E Ekjon

          I've found this in the parent's source: onchange="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$txtChange\',\'\')', 0)" But what would be the syntax to call this from the popup window script? Do I call it after changing the value? like: Response.Write("<script language='javascript'>function changeParent(){window.opener.document.getElementById('ctl00$ContentPlaceHolder1$txtChange').value='Change'; __doPostBack(\'ctl00$ContentPlaceHolder1$txtChange\',\'\')', 0); }window.close();</script>"); Thanks.

          T Offline
          T Offline
          TylerBrinks
          wrote on last edited by
          #4

          Put a client side javascript function call in the onchange event of your field in the parent window. That should fire when your popup changes the field. You can force the postback in that function.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups