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
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
Re: What is the problem in it?
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
Re: What is the problem in it?
Quote:
Originally Posted by
gep13
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
Re: What is the problem in it?
Quote:
Originally Posted by
ravininave
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.
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
Re: What is the problem in it?
Quote:
Originally Posted by
gep13
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.
Re: What is the problem in it?
What if you try using the complete absolute url?
Gary
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?
Re: What is the problem in it?
Quote:
Originally Posted by
brin351
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.
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
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