Results 1 to 13 of 13

Thread: What is the problem in it?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    243

    What is the problem in it?

    Hi I'm using following code
    Code:
     Dim newWin As String = ("<script language='javascript'>" + "window.open('successMess.aspx' , 'Print', 'height=200, width=220, menubar=no, toolbar=no, scrollbars=no, resizable=no'); </script>")
                        ClientScript.RegisterStartupScript(Me.GetType(), "pop", newWin)
    
    Response.Redirect(MyPanel.aspx", False)
    Windows.open runs perfectly when I remore response.redirect statement and doesn't works when I add it. What could b the problem. I'm not getting.
    Thanx

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: What is the problem in it?

    Hey,

    This is because the Response is being redirected, as a result the JavaScript is never being injected onto the page.

    Gary

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    243

    Re: What is the problem in it?

    So, how could I do it.?

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: What is the problem in it?

    Hey,

    Rather than using the Response.Redirect, since you are already injecting JavaScript, use JavaScript to change the current page, i.e use window.location = "<your url here>";

    Gary

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    243

    Re: What is the problem in it?

    Quote Originally Posted by gep13 View Post
    Hey,

    Rather than using the Response.Redirect, since you are already injecting JavaScript, use JavaScript to change the current page, i.e use window.location = "<your url here>";

    Gary
    Code:
    Dim newWin As String = ("<script language='javascript'>" + "window.open('successMess.aspx' , 'Print', 'height=200, width=220, menubar=no, toolbar=no, scrollbars=no, resizable=no'); </script>")
                        ClientScript.RegisterStartupScript(Me.GetType(), "pop", newWin)
    
    Dim cstype As Type = Me.[GetType]()
                    Dim cs As ClientScriptManager = Page.ClientScript
                    cs.RegisterStartupScript(cstype, "dateSrpt", "<script>window.location='cpanel/MyPanel.aspx'</script>")
    Not working. Can u help with little code

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    243

    Re: What is the problem in it?

    Quote Originally Posted by ravininave View Post
    Code:
    Dim newWin As String = ("<script language='javascript'>" + "window.open('successMess.aspx' , 'Print', 'height=200, width=220, menubar=no, toolbar=no, scrollbars=no, resizable=no'); </script>")
                        ClientScript.RegisterStartupScript(Me.GetType(), "pop", newWin)
    
    Dim cstype As Type = Me.[GetType]()
                    Dim cs As ClientScriptManager = Page.ClientScript
                    cs.RegisterStartupScript(cstype, "dateSrpt", "<script>window.location='cpanel/MyPanel.aspx'</script>")
    Not working. Can u help with little code
    I feel problem in this line
    Code:
    cs.RegisterStartupScript(cstype, "dateSrpt", "<script>window.location='cpanel/MyPanel.aspx'</script>")
    My .aspx form is in inner cpanel folder. If I write ~/cpanel/MyPanel.aspx it still not working.

  7. #7
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: What is the problem in it?

    The ~ is rendered by the ASP.Net engine, and won't work on the client.

    When it opens in the browser, what URL is it trying to open?

    Gary

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    243

    Re: What is the problem in it?

    Quote Originally Posted by gep13 View Post
    The ~ is rendered by the ASP.Net engine, and won't work on the client.

    When it opens in the browser, what URL is it trying to open?

    Gary
    site/~/cpanel/MyPanel.aspx
    if I try only 'cpanel/MyPanel.aspx' then it doesn't works.
    '/cpanel/MyPanel.aspx' this also doesn't works.

  9. #9
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: What is the problem in it?

    What if you try using the complete absolute url?

    Gary

  10. #10
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Re: What is the problem in it?

    I have I got this right.

    Your opening a popup window and that is working
    Your trying to redirect the Parient window to another page as well and that is not working

    Is that right?
    The problem with computers is their nature is pure logic. Just once I'd like my computer to do something deluded.

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    243

    Re: What is the problem in it?

    Quote Originally Posted by brin351 View Post
    I have I got this right.

    Your opening a popup window and that is working
    Your trying to redirect the Parient window to another page as well and that is not working

    Is that right?
    Yes, I think that there is some syntax error.

  12. #12
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Re: What is the problem in it?

    No syntax error the path to your page is invalid. Try what Gary suggested - absolute url

    window.location='/cpanel/MyPanel.aspx'

    asuming "cpanel" is a folder under the website root directory
    The problem with computers is their nature is pure logic. Just once I'd like my computer to do something deluded.

  13. #13
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: What is the problem in it?

    When it tries to open the page (assuming IE) right click on the page, and go to properties. What is the exact url that it is trying to open.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width