Open new window without javascript
-
Hi all, I will try explain you my problem. I have file pdf in a field of my database of SQ-Server. I have a master page and content. I want two options: or open new page for see pdf with focus in it or response.redirect into content. I get open my pdf with:
Protected Sub gridView\_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView.SelectedIndexChanged Try If GridView.SelectedIndex >= 0 Then Response.Redirect("~/Formularios/VisorFicheros.aspx?Id=" + gridView.SelectedRow.Cells(1).Text) End If Catch ex As Exception End Try End Sub
but it open all pdf in my master page losing my main menu etc, open my pdf to full page. i would like to open the pdf in a content of master page but doesn't work i put the code of "visorficheros.aspx" that open my pdf from database
Protected Sub Page\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Try Dim id As Integer = Request.QueryString("Id") Dim imagedata() As Byte = Ficheros.ObtenerContenidoFichero(id) Response.ClearContent() Response.ContentType = "application/pdf" Response.AddHeader("content-length", imagedata.Length.ToString()) Response.BinaryWrite(imagedata) Response.Flush() Response.Close() Catch ex As Exception End Try End Sub
Some idea? also I will try to open with javascript with window.open (I don't like it I prefer that my code be only vb.net without javascript) I put the code:
Protected Sub gridView\_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView.SelectedIndexChanged Try If GridView.SelectedIndex >= 0 Then 'Response.Write("<script language='JavaScript'>window.open('VisorFicheros.aspx?Id=" + gridView.SelectedRow.Cells(1).Text + "')</script>" End If Catch ex As Exception End Try End Sub
but I have 2 problem, the first more important is that I.E block it because is a pop-up and the second problem is that I lost the focus and it is put behind of master page. Is possible to make it without javascript, vbscript etc only with vb.net? some idea? thanks for your help, I am becoming madwoman with it X|
-
Hi all, I will try explain you my problem. I have file pdf in a field of my database of SQ-Server. I have a master page and content. I want two options: or open new page for see pdf with focus in it or response.redirect into content. I get open my pdf with:
Protected Sub gridView\_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView.SelectedIndexChanged Try If GridView.SelectedIndex >= 0 Then Response.Redirect("~/Formularios/VisorFicheros.aspx?Id=" + gridView.SelectedRow.Cells(1).Text) End If Catch ex As Exception End Try End Sub
but it open all pdf in my master page losing my main menu etc, open my pdf to full page. i would like to open the pdf in a content of master page but doesn't work i put the code of "visorficheros.aspx" that open my pdf from database
Protected Sub Page\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Try Dim id As Integer = Request.QueryString("Id") Dim imagedata() As Byte = Ficheros.ObtenerContenidoFichero(id) Response.ClearContent() Response.ContentType = "application/pdf" Response.AddHeader("content-length", imagedata.Length.ToString()) Response.BinaryWrite(imagedata) Response.Flush() Response.Close() Catch ex As Exception End Try End Sub
Some idea? also I will try to open with javascript with window.open (I don't like it I prefer that my code be only vb.net without javascript) I put the code:
Protected Sub gridView\_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView.SelectedIndexChanged Try If GridView.SelectedIndex >= 0 Then 'Response.Write("<script language='JavaScript'>window.open('VisorFicheros.aspx?Id=" + gridView.SelectedRow.Cells(1).Text + "')</script>" End If Catch ex As Exception End Try End Sub
but I have 2 problem, the first more important is that I.E block it because is a pop-up and the second problem is that I lost the focus and it is put behind of master page. Is possible to make it without javascript, vbscript etc only with vb.net? some idea? thanks for your help, I am becoming madwoman with it X|
You can't launch a new page with vb.net, at all. It runs on the server. An anchor tag with target='_blank' will open a new page, this new page can be passed an id on the URL, and generate/return/whatever your PDF
Christian Graus Driven to the arms of OSX by Vista.
-
You can't launch a new page with vb.net, at all. It runs on the server. An anchor tag with target='_blank' will open a new page, this new page can be passed an id on the URL, and generate/return/whatever your PDF
Christian Graus Driven to the arms of OSX by Vista.
-
where I put target='_blank' ? if I put it into windows.open is the same I.E will block it because it believes that is pop-up and into response.redirect is not possible. sorry I don't understand your solve.
You put
target="_blank"
in theA
tag, eg:<a href="page.html" target="_blank">link</a>
And since you have no control over IE's popup blocker there's not much else you can do if it's blocked. Regards, --Perspx
"A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year."
-Andrew Tanenbaum
"Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer."
-Fred Brooks -
You put
target="_blank"
in theA
tag, eg:<a href="page.html" target="_blank">link</a>
And since you have no control over IE's popup blocker there's not much else you can do if it's blocked. Regards, --Perspx
"A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year."
-Andrew Tanenbaum
"Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer."
-Fred Brookssorry but I don't have
<a href="page.html" target="_blank">link</a>
I have
Response.Write("<script language='JavaScript'>window.open('VisorFicheros.aspx?Id=" + gridView.SelectedRow.Cells(1).Text + "',target='_blank' )</script>")
but it is the same that
Response.Write("<script language='JavaScript'>window.open('VisorFicheros.aspx?Id=" + gridView.SelectedRow.Cells(1).Text + "')</script>")
I don't see any diferent, I.E continue block and with I.E.6 the focus is into master page and not into new window for me is important make it without window.open because i.e block it. For sample if I make it with a linkbutton work well the window.open (doesn't block i.e) but I don't know like do it with into my event gridView_SelectedIndexChanged, any idea? thanks for all
-
sorry but I don't have
<a href="page.html" target="_blank">link</a>
I have
Response.Write("<script language='JavaScript'>window.open('VisorFicheros.aspx?Id=" + gridView.SelectedRow.Cells(1).Text + "',target='_blank' )</script>")
but it is the same that
Response.Write("<script language='JavaScript'>window.open('VisorFicheros.aspx?Id=" + gridView.SelectedRow.Cells(1).Text + "')</script>")
I don't see any diferent, I.E continue block and with I.E.6 the focus is into master page and not into new window for me is important make it without window.open because i.e block it. For sample if I make it with a linkbutton work well the window.open (doesn't block i.e) but I don't know like do it with into my event gridView_SelectedIndexChanged, any idea? thanks for all
You can use the JavaScript location.href property as follows:
location.href = [URL];
to open the page in the current window. Regards, --Perspx
"A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year."
-Andrew Tanenbaum
"Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer."
-Fred Brooks -
sorry but I don't have
<a href="page.html" target="_blank">link</a>
I have
Response.Write("<script language='JavaScript'>window.open('VisorFicheros.aspx?Id=" + gridView.SelectedRow.Cells(1).Text + "',target='_blank' )</script>")
but it is the same that
Response.Write("<script language='JavaScript'>window.open('VisorFicheros.aspx?Id=" + gridView.SelectedRow.Cells(1).Text + "')</script>")
I don't see any diferent, I.E continue block and with I.E.6 the focus is into master page and not into new window for me is important make it without window.open because i.e block it. For sample if I make it with a linkbutton work well the window.open (doesn't block i.e) but I don't know like do it with into my event gridView_SelectedIndexChanged, any idea? thanks for all
When you use the window.open method the second parameter is the target, and you can't name the parameters in a function call.
Response.Write("window.open('VisorFicheros.aspx?Id=" + gridView.SelectedRow.Cells(1).Text + "','_blank');")
Despite everything, the person most likely to be fooling you next is yourself.
-
where I put target='_blank' ? if I put it into windows.open is the same I.E will block it because it believes that is pop-up and into response.redirect is not possible. sorry I don't understand your solve.
Add target="_blenk" attribute in A href tag link below link Click Got it? Techie From Surat
-
Add target="_blenk" attribute in A href tag link below link Click Got it? Techie From Surat
If I put _blank I don't see diferent. My first problem is that I don't want to use javascript, I want to use only vb.net (asp.net) and my second problem is that when I see that with response.redirect I can't open a new page I have that use javascript with windows.open, with it i can open a new window for me is not necessary the attrib _blank, this is not my problem my problem later with windows.open are 2 the firs and more important is that I.E block my page because is a pop-up, I can't say to all users that unblock it because this is internet :) I need to give a solution by code that not depend of user. My second problem with windows.open is that sometime the focus is lost and I see my main page and not my new window (I can see it if I tabulate). Thanks for your help.
-
If I put _blank I don't see diferent. My first problem is that I don't want to use javascript, I want to use only vb.net (asp.net) and my second problem is that when I see that with response.redirect I can't open a new page I have that use javascript with windows.open, with it i can open a new window for me is not necessary the attrib _blank, this is not my problem my problem later with windows.open are 2 the firs and more important is that I.E block my page because is a pop-up, I can't say to all users that unblock it because this is internet :) I need to give a solution by code that not depend of user. My second problem with windows.open is that sometime the focus is lost and I see my main page and not my new window (I can see it if I tabulate). Thanks for your help.
There is no other way to open a new window other then any client side script. You have to use either Javascript or vbscript.