Here's the OnClick event code for a button inside an UpdatePanel:
protected void btnReport_Click(object sender, EventArgs e)
{
this.ClientScript.RegisterStartupScript(this.GetType(), "viewRepo", "<script>window.open('RepoViewer.aspx','viewReport')</script>");
}
As you can see, after returning from code-behind I want to open a new browser window with a given web form. Well, this works correctly without an UpdatePanel, or when EnablePartialRendering is set to false.
If EnablePartialRendering is set to true, a new window does not open.
Any workarounds?
-Benton
I'm having the same issue.
Rob
Hi Benton,
I'd the same problem, but I solve it, use've just to remove the tag scrip from your code (belive, it works!!!)
I used before this:
Sub wOpen(ByVal fWindow As String, ByVal fNameWin As String, ByVal fWidth As Integer, ByVal fHeight As Integer, ByVal fMenu As Boolean, ByVal fResizable As Boolean, ByVal fScroll As Boolean)
Dim strJ As String
strJ = "<script language='text/javascript'>"
strJ &= "window.open('" & fWindow & "', '" & fNameWin & "', "
strJ &= "'width=" & fWidth & ", height=" & fHeight & ", menubar="
If fMenu = True Then
strJ &= "yes"
Else
strJ &= "no"
End If
strJ &= ", resizable="
If fResizable = True Then
strJ &= "yes"
Else
strJ &= "no"
End If
strJ &= ", scrollbars="
If fScroll = True Then
strJ &= "yes"
Else
strJ &= "no"
End If
strJ &= "')<"
strJ &= "/script>"
'Page.RegisterClientScriptBlock("wOpen", strJ)
'Me.ClientScript.RegisterStartupScript(Me.Page.GetType(), "wOpen", strJ, True)
Me.ClientScript.RegisterStartupScript(Me.GetType(), "wOpen", strJ, True)
End Sub
And now I'm using:
Sub xOpen(ByVal fWindow As String, ByVal fNameWin As String, ByVal fWidth As Integer, ByVal fHeight As Integer, ByVal fMenu As Boolean, ByVal fResizable As Boolean, ByVal fScroll As Boolean)
Dim strJ As String
strJ = "window.open('" & fWindow & "', '" & fNameWin & "', "
strJ &= "'width=" & fWidth & ", height=" & fHeight & ", menubar="
If fMenu = True Then
strJ &= "yes"
Else
strJ &= "no"
End If
strJ &= ", resizable="
If fResizable = True Then
strJ &= "yes"
Else
strJ &= "no"
End If
strJ &= ", scrollbars="
If fScroll = True Then
strJ &= "yes"
Else
strJ &= "no"
End If
strJ &= "')"
Me.ClientScript.RegisterStartupScript(Me.GetType(), "xOpen", strJ, True)
End Sub
Note that I just remove the javascript tag, and it works very well.
jb.alessandro:
Hi Benton,
I'd the same problem, but I solve it, use've just to remove the tag scrip from your code (belive, it works!!!)
Note that I just remove the javascript tag, and it works very well.
Hi JB,
I am having the same problem. I hope there is a way to fix it with my case. Below is my script. Thanks
Response.Write(
"<script>window.open('../MailCenter/mailMain.aspx?tomemid=" +Convert.ToInt32(ViewState["MemID"]) +"','_blank');</script>");How is it possible to remove the tags in this case? I tried but it didn't work.
blumonde
No comments:
Post a Comment