|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Launch a new browser windowHi;
From my code behind how do I launch a new browser window (ie keeping my existing page also so where before there was 1 copy of IE running, now there are two). Two scenarios. First scenario it's fire and forget. Once the second browser is launched, it will never talk to the first page again. Second, it pops up for the user to enter some information. Once entered and then click submit on the launched page, the browser exits and the data entered is returned to the first browser/page. You're talking about pure client-side code. The server doesn't even notice
if another window has been opened or closed. Server-side code simply renders a page and evaluates a browser's form/query string/cookie return values. Nothing more. HTH, Axel Dahmen ------------ Show quoteHide quote "David Thielen" <thielen@nospam.nospam> schrieb im Newsbeitrag news:5D8FC8E9-99D9-4F9A-A625-F9A1D1109451@microsoft.com... > Hi; > > From my code behind how do I launch a new browser window (ie keeping my > existing page also so where before there was 1 copy of IE running, now there > are two). > > Two scenarios. First scenario it's fire and forget. Once the second browser > is launched, it will never talk to the first page again. > > Second, it pops up for the user to enter some information. Once entered and > then click submit on the launched page, the browser exits and the data > entered is returned to the first browser/page. > > -- > thanks - dave > david_at_windward_dot_net > http://www.windwardreports.com > Ok, that makes sense. So launching a second browser is still a totally client
side operationg - right? Show quoteHide quote "Axel Dahmen" wrote: > You're talking about pure client-side code. The server doesn't even notice > if another window has been opened or closed. > > Server-side code simply renders a page and evaluates a browser's form/query > string/cookie return values. Nothing more. > > HTH, > Axel Dahmen > > ------------ > "David Thielen" <thielen@nospam.nospam> schrieb im Newsbeitrag > news:5D8FC8E9-99D9-4F9A-A625-F9A1D1109451@microsoft.com... > > Hi; > > > > From my code behind how do I launch a new browser window (ie keeping my > > existing page also so where before there was 1 copy of IE running, now > there > > are two). > > > > Two scenarios. First scenario it's fire and forget. Once the second > browser > > is launched, it will never talk to the first page again. > > > > Second, it pops up for the user to enter some information. Once entered > and > > then click submit on the launched page, the browser exits and the data > > entered is returned to the first browser/page. > > > > -- > > thanks - dave > > david_at_windward_dot_net > > http://www.windwardreports.com > > > > > Hi Dave,
You just need a bit of JavaScript in both pages. Here's a quick demonstration. The first page, (basepage.aspx) launches the secondary window on startup. Here's the code: <%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Dim myURL As String myURL = "second.aspx" Dim scriptString As String = "<script language=JavaScript>" scriptString += "window.open('" & myURL & "','window1','width=300,height=200'); <" scriptString += "/" scriptString += "script>" ClientScript.RegisterStartupScript(Me.GetType, "Startup", scriptString) End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:textbox id="TextBox1" runat="server"></asp:textbox><br /> <br /> <asp:button id="Button1" runat="server" text="Button" /> </div> </form> </body> </html> The second page takes the value from its textbox and passes it back down to the caller page. Then it closes. Here's the code for second.aspx. <%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> <script language="javascript"> function PutVal() { Show quoteHide quote window.opener.document.getElementById("TextBox1").value=document.getElementById("TextBox1").value; window.close(); } </script></head><body> <form id="form1" runat="server"> <div> <asp:textbox id="TextBox1" runat="server"></asp:textbox><br /> <br /> <asp:button id="Button1" onclientclick="PutVal()" runat="server"text="Button" /> </div> </form></body></html>Let us know if this helps?KenMicrosoft MVP [ASP.NET]"David Thielen" <thielen@nospam.nospam> wrote in messagenews:5D8FC8E9-99D9-4F9A-A625-F9A1D1109***@microsoft.com...> Hi;>> From my code behind how do I launch a new browser window (ie keeping my> existing page also so where before there was 1 copy of IE running, nowthere> are two).>> Two scenarios. First scenario it's fire and forget. Once the secondbrowser> is launched, it will never talk to the first page again.>> Second, it pops up for the user to enter some information. Once enteredand> then click submit on the launched page, the browser exits and the data> entered is returned to the first browser/page.>> --> thanks - dave> david_at_windward_dot_net> http://www.windwardreports.com> thank you to both of you.
Show quoteHide quote "Ken Cox - Microsoft MVP" wrote: and the data> entered is returned to the first browser/page.>> --> thanks - dave> david_at_windward_dot_net> http://www.windwardreports.com>> Hi Dave, > > You just need a bit of JavaScript in both pages. Here's a quick > demonstration. > > > The first page, (basepage.aspx) launches the secondary window on startup. > Here's the code: > > <%@ Page Language="VB" %> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > <script runat="server"> > > Protected Sub Page_Load(ByVal sender As Object, ByVal e As > System.EventArgs) > Dim myURL As String > myURL = "second.aspx" > Dim scriptString As String = "<script language=JavaScript>" > scriptString += "window.open('" & myURL & > "','window1','width=300,height=200'); <" > scriptString += "/" > scriptString += "script>" > ClientScript.RegisterStartupScript(Me.GetType, "Startup", > scriptString) > End Sub > </script> > > <html xmlns="http://www.w3.org/1999/xhtml" > > <head runat="server"> > <title>Untitled Page</title> > </head> > <body> > <form id="form1" runat="server"> > <div> > <asp:textbox id="TextBox1" runat="server"></asp:textbox><br /> > <br /> > <asp:button id="Button1" runat="server" text="Button" /> </div> > </form> > </body> > </html> > > The second page takes the value from its textbox and passes it back down to > the caller page. Then it closes. Here's the code for second.aspx. > > <%@ Page Language="VB" %> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > <script runat="server"> > > Protected Sub Page_Load(ByVal sender As Object, ByVal e As > System.EventArgs) > > End Sub > </script> > > <html xmlns="http://www.w3.org/1999/xhtml" > > <head runat="server"> > <title>Untitled Page</title> > <script language="javascript"> > function PutVal() > { > window.opener.document.getElementById("TextBox1").value=document.getElementById("TextBox1").value; window.close(); } </script></head><body> <form id="form1" runat="server"> <div> <asp:textbox id="TextBox1" runat="server"></asp:textbox><br /> <br /> <asp:button id="Button1" onclientclick="PutVal()" runat="server"text="Button" /> </div> </form></body></html>Let us know if this helps?KenMicrosoft MVP [ASP.NET]"David Thielen" <thielen@nospam.nospam> wrote in messagenews:5D8FC8E9-99D9-4F9A-A625-F9A1D1109***@microsoft.com...> Hi;>> From my code behind how do I launch a new browser window (ie keeping my> existing page also so where before there was 1 copy of IE running, nowthere> are two).>> Two scenarios. First scenario it's fire and forget. Once the secondbrowser> is launched, it will never talk to the first page again.>> Second, it pops up for the user to enter some information. Once enteredand> then click submit on the launched page, the browser exits Show quoteHide quote > > Hi;
I'm using this is a couple of places but in 1 it doesn't work. What I need is to build the text in the pop-up when they hit a button because it is based on values entered in controls and a query from the database. So... Is there a way in the postback to redraw my page plus cause a popup window to popup with text I am determining in the code behind? Show quoteHide quote "Ken Cox - Microsoft MVP" wrote: and the data> entered is returned to the first browser/page.>> --> thanks - dave> david_at_windward_dot_net> http://www.windwardreports.com>> Hi Dave, > > You just need a bit of JavaScript in both pages. Here's a quick > demonstration. > > > The first page, (basepage.aspx) launches the secondary window on startup. > Here's the code: > > <%@ Page Language="VB" %> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > <script runat="server"> > > Protected Sub Page_Load(ByVal sender As Object, ByVal e As > System.EventArgs) > Dim myURL As String > myURL = "second.aspx" > Dim scriptString As String = "<script language=JavaScript>" > scriptString += "window.open('" & myURL & > "','window1','width=300,height=200'); <" > scriptString += "/" > scriptString += "script>" > ClientScript.RegisterStartupScript(Me.GetType, "Startup", > scriptString) > End Sub > </script> > > <html xmlns="http://www.w3.org/1999/xhtml" > > <head runat="server"> > <title>Untitled Page</title> > </head> > <body> > <form id="form1" runat="server"> > <div> > <asp:textbox id="TextBox1" runat="server"></asp:textbox><br /> > <br /> > <asp:button id="Button1" runat="server" text="Button" /> </div> > </form> > </body> > </html> > > The second page takes the value from its textbox and passes it back down to > the caller page. Then it closes. Here's the code for second.aspx. > > <%@ Page Language="VB" %> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > <script runat="server"> > > Protected Sub Page_Load(ByVal sender As Object, ByVal e As > System.EventArgs) > > End Sub > </script> > > <html xmlns="http://www.w3.org/1999/xhtml" > > <head runat="server"> > <title>Untitled Page</title> > <script language="javascript"> > function PutVal() > { > window.opener.document.getElementById("TextBox1").value=document.getElementById("TextBox1").value; window.close(); } </script></head><body> <form id="form1" runat="server"> <div> <asp:textbox id="TextBox1" runat="server"></asp:textbox><br /> <br /> <asp:button id="Button1" onclientclick="PutVal()" runat="server"text="Button" /> </div> </form></body></html>Let us know if this helps?KenMicrosoft MVP [ASP.NET]"David Thielen" <thielen@nospam.nospam> wrote in messagenews:5D8FC8E9-99D9-4F9A-A625-F9A1D1109***@microsoft.com...> Hi;>> From my code behind how do I launch a new browser window (ie keeping my> existing page also so where before there was 1 copy of IE running, nowthere> are two).>> Two scenarios. First scenario it's fire and forget. Once the secondbrowser> is launched, it will never talk to the first page again.>> Second, it pops up for the user to enter some information. Once enteredand> then click submit on the launched page, the browser exits Show quoteHide quote > > Hi;
Ok, I'm half way there - I now have it adding the script only when I want it. But my google popup blocker is stopping it. Is there a way that google will allow a popup? Show quoteHide quote "David Thielen" wrote: > Hi; > > I'm using this is a couple of places but in 1 it doesn't work. > > What I need is to build the text in the pop-up when they hit a button > because it is based on values entered in controls and a query from the > database. > > So... > > Is there a way in the postback to redraw my page plus cause a popup window > to popup with text I am determining in the code behind? > > -- > thanks - dave > david_at_windward_dot_net > http://www.windwardreports.com > > > > "Ken Cox - Microsoft MVP" wrote: > > > Hi Dave, > > > > You just need a bit of JavaScript in both pages. Here's a quick > > demonstration. > > > > > > The first page, (basepage.aspx) launches the secondary window on startup. > > Here's the code: > > > > <%@ Page Language="VB" %> > > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > > > <script runat="server"> > > > > Protected Sub Page_Load(ByVal sender As Object, ByVal e As > > System.EventArgs) > > Dim myURL As String > > myURL = "second.aspx" > > Dim scriptString As String = "<script language=JavaScript>" > > scriptString += "window.open('" & myURL & > > "','window1','width=300,height=200'); <" > > scriptString += "/" > > scriptString += "script>" > > ClientScript.RegisterStartupScript(Me.GetType, "Startup", > > scriptString) > > End Sub > > </script> > > > > <html xmlns="http://www.w3.org/1999/xhtml" > > > <head runat="server"> > > <title>Untitled Page</title> > > </head> > > <body> > > <form id="form1" runat="server"> > > <div> > > <asp:textbox id="TextBox1" runat="server"></asp:textbox><br /> > > <br /> > > <asp:button id="Button1" runat="server" text="Button" /> </div> > > </form> > > </body> > > </html> > > > > The second page takes the value from its textbox and passes it back down to > > the caller page. Then it closes. Here's the code for second.aspx. > > > > <%@ Page Language="VB" %> > > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > > > <script runat="server"> > > > > Protected Sub Page_Load(ByVal sender As Object, ByVal e As > > System.EventArgs) > > > > End Sub > > </script> > > > > <html xmlns="http://www.w3.org/1999/xhtml" > > > <head runat="server"> > > <title>Untitled Page</title> > > <script language="javascript"> > > function PutVal() > > { > > window.opener.document.getElementById("TextBox1").value=document.getElementById("TextBox1").value; window.close(); } </script></head><body> <form id="form1" runat="server"> <div> <asp:textbox id="TextBox1" runat="server"></asp:textbox><br /> <br /> <asp:button id="Button1" onclientclick="PutVal()" runat="server"text="Button" /> </div> </form></body></html>Let us know if this helps?KenMicrosoft MVP [ASP.NET]"David Thielen" <thielen@nospam.nospam> wrote in messagenews:5D8FC8E9-99D9-4F9A-A625-F9A1D1109***@microsoft.com...> Hi;>> From my code behind how do I launch a new browser window (ie keeping my> existing page also so where before there was 1 copy of IE running, nowthere> are two).>> Two scenarios. First scenario it's fire and forget. Once the secondbrowser> is launched, it will never talk to the first page again.>> Second, it pops up for the user to enter some information. Once enteredand> then click submit on the launched page, the browser exits > and the data> entered is returned to the first browser/page.>> --> thanks - dave> david_at_windward_dot_net> http://www.windwardreports.com> > > > > Hi Dave,
I'm afraid we can not control google or its toolbar through client-side scripts:(. However, since the "window.open" method will return a window's handle variable, you can check it to see whether the windows has correctly been opened, if not, that means it is blocked by something (maybe google bar), then just display a message to inform the client user of this. How do you think of this? Regards, Steven Cheng Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.) I was afraid that was it - I'm going to have to just use the window I am in
to be safe. Leave it to advertisers to screw this up too... Show quoteHide quote "Steven Cheng[MSFT]" wrote: > Hi Dave, > > I'm afraid we can not control google or its toolbar through client-side > scripts:(. However, since the "window.open" method will return a window's > handle variable, you can check it to see whether the windows has correctly > been opened, if not, that means it is blocked by something (maybe google > bar), then just display a message to inform the client user of this. How > do you think of this? > > Regards, > > Steven Cheng > Microsoft Online Community Support > > > ================================================== > > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > > ================================================== > > > This posting is provided "AS IS" with no warranties, and confers no rights. > > > > Get Secure! www.microsoft.com/security > (This posting is provided "AS IS", with no warranties, and confers no > rights.) > > I agree that this will be safer.
Thanks for the followup. Regards, Steven Cheng Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.)
How to access control in FormView
Creating N rows of controls ObjectDataSource ... could not find a non-generic method ... that has parameters: ... enable/disable text box based on dropdownlist via javascript post-back when the filename to upload changes How to add a dropdownlist to the column header in a GridView? Custom Web control question FormView/ItemTemplate - MultiView, Radio, & checkbox Overriding Calendar.CreateChildControls PostBack and dynamically created controls |
|||||||||||||||||||||||