472,789 Members | 818 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 software developers and data experts.

Popup Browser window

A.M
Hi,

I require to have a button on the weinforms pages such that upon user click
on the button, the event handler pops up another browser window to another
url and current browser screen remains unchanged.
How can i do that?

Thanks,
Ali

Nov 18 '05 #1
10 1407
you'll have to use clientside code with a window.open()

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"A.M" <IH*******@sapm123.com> wrote in message
news:uI**************@TK2MSFTNGP09.phx.gbl...
Hi,

I require to have a button on the weinforms pages such that upon user click on the button, the event handler pops up another browser window to another
url and current browser screen remains unchanged.
How can i do that?

Thanks,
Ali

Nov 18 '05 #2
A.M
Thanks for reply,
The problem is I have to write something into the database and then pop that
window.
Can I send some special HTTP header code to responce object so it just pop
another window in client side and don't change the current window content?

Thanks again,
Ali


"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
you'll have to use clientside code with a window.open()

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"A.M" <IH*******@sapm123.com> wrote in message
news:uI**************@TK2MSFTNGP09.phx.gbl...
Hi,

I require to have a button on the weinforms pages such that upon user

click
on the button, the event handler pops up another browser window to another url and current browser screen remains unchanged.
How can i do that?

Thanks,
Ali


Nov 18 '05 #3
Nope.
You could have the window.open() occur and then fire a postback perhaps

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"A.M" <IH*******@sapm123.com> wrote in message
news:Od**************@TK2MSFTNGP10.phx.gbl...
Thanks for reply,
The problem is I have to write something into the database and then pop that window.
Can I send some special HTTP header code to responce object so it just pop
another window in client side and don't change the current window content?

Thanks again,
Ali


"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
you'll have to use clientside code with a window.open()

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"A.M" <IH*******@sapm123.com> wrote in message
news:uI**************@TK2MSFTNGP09.phx.gbl...
Hi,

I require to have a button on the weinforms pages such that upon user

click
on the button, the event handler pops up another browser window to another url and current browser screen remains unchanged.
How can i do that?

Thanks,
Ali



Nov 18 '05 #4
In addition to what Curt_C said you could also do the following

Inside the postback event handler(in your case a submit button???), after your db updates add (in C#

Page.RegisterStartupScriptBlock("", "<script language=\"Javascript\">window.open(yoururl and other window properties)</script>")

This will be rendered on the HTML page after postback and Javascript(when it's executed on rendering) will open the new window

Suresh

----- A.M wrote: ----

Thanks for reply
The problem is I have to write something into the database and then pop tha
window
Can I send some special HTTP header code to responce object so it just po
another window in client side and don't change the current window content

Thanks again
Al


"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in messag
news:%2****************@TK2MSFTNGP11.phx.gbl..
you'll have to use clientside code with a window.open(
--

Curt Christianso
Owner/Lead Developer, DF-Softwar
www.Darkfalz.co
"A.M" <IH*******@sapm123.com> wrote in messag news:uI**************@TK2MSFTNGP09.phx.gbl..
Hi
I require to have a button on the weinforms pages such that upon use

clic
on the button, the event handler pops up another browser window t

anothe url and current browser screen remains unchanged
How can i do that
Thanks

Al
>>>>

Nov 18 '05 #5
Try:

Process.Start("www.sitename.com")

-----Original Message-----
Hi,

I require to have a button on the weinforms pages such that upon user clickon the button, the event handler pops up another browser window to anotherurl and current browser screen remains unchanged.
How can i do that?

Thanks,
Ali

.

Nov 18 '05 #6
special note: that most popup blockers will prevent this method from
working. also so should winxp sp2 (which has a popup blocker) when its
released.
-- bruce (sqlwork.com)

"Suresh" <an*******@discussions.microsoft.com> wrote in message
news:93**********************************@microsof t.com...
In addition to what Curt_C said you could also do the following.

Inside the postback event handler(in your case a submit button???), after your db updates add (in C#)
Page.RegisterStartupScriptBlock("", "<script language=\"Javascript\">window.open(yoururl and other window
properties)</script>");
This will be rendered on the HTML page after postback and Javascript(when it's executed on rendering) will open the new window.
Suresh.

----- A.M wrote: -----

Thanks for reply,
The problem is I have to write something into the database and then pop that window.
Can I send some special HTTP header code to responce object so it just pop another window in client side and don't change the current window content?
Thanks again,
Ali


"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
> you'll have to use clientside code with a window.open()
>> --

> Curt Christianson
> Owner/Lead Developer, DF-Software
> www.Darkfalz.com
>>> "A.M" <IH*******@sapm123.com> wrote in message

> news:uI**************@TK2MSFTNGP09.phx.gbl...
>> Hi,
>>>> I require to have a button on the weinforms pages such that upon
user
> click
>> on the button, the event handler pops up another browser window to

another >> url and current browser screen remains unchanged.
>> How can i do that?
>>>> Thanks,
>> Ali
>>>>>>>>

Nov 18 '05 #7
A.M

So what would be the best method haveing a new browser window contains the
some information ?
"bruce barker" <no***********@safeco.com> wrote in message
news:eO**************@TK2MSFTNGP12.phx.gbl...
special note: that most popup blockers will prevent this method from
working. also so should winxp sp2 (which has a popup blocker) when its
released.
-- bruce (sqlwork.com)

"Suresh" <an*******@discussions.microsoft.com> wrote in message
news:93**********************************@microsof t.com...
In addition to what Curt_C said you could also do the following.

Inside the postback event handler(in your case a submit button???), after
your db updates add (in C#)

Page.RegisterStartupScriptBlock("", "<script language=\"Javascript\">window.open(yoururl and other window
properties)</script>");

This will be rendered on the HTML page after postback and Javascript(when it's executed on rendering) will open the new window.

Suresh.

----- A.M wrote: -----

Thanks for reply,
The problem is I have to write something into the database and then pop that
window.
Can I send some special HTTP header code to responce object so it

just pop
another window in client side and don't change the current window

content?

Thanks again,
Ali


"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
> you'll have to use clientside code with a window.open()
>> --
> Curt Christianson
> Owner/Lead Developer, DF-Software
> www.Darkfalz.com
>>> "A.M" <IH*******@sapm123.com> wrote in message
> news:uI**************@TK2MSFTNGP09.phx.gbl...
>> Hi,
>>>> I require to have a button on the weinforms pages such that

upon user > click
>> on the button, the event handler pops up another browser window

to another
>> url and current browser screen remains unchanged.
>> How can i do that?
>>>> Thanks,
>> Ali
>>>>>>>>


Nov 18 '05 #8
A.M

Thanks Steven for reply,

I saw the aspx file and i like the idea of having <a> tag and trigger it
using OpenWindow(url) when we want to popup the browser window.

I think you missed the file OpenWindow.aspx.cs. could you send it as well ?

Thanks again,
Ali


"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:BJ**************@cpmsftngxa06.phx.gbl...
Thanks for all your responses and suggestions.

Hi Ali,

As for this problem, I think Suresh and Curt's suggestions are quite
reasonable. You may first post back the page to finish some certain
serverside operations them use the Page.RegisterStartupScript function to
register the "open window" script.

Since some other ones have mentioned that the "window.open" maybe blocked
by some certain browsers and even impossible to use after XP sp2, I think
you can try the following means to workaround it:
put a <a href="the url of the page you want to open" target="_blank"
style="display:none" />
this hyperlink will open the specified url in a new browser window ,then
you can use javascript to programatically fire its click event. How do you
think of this?

I've also attached a sample page on the above means, please refer to it if
you feel anything unclear. Thanks.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #9
Hi Ali,

Thanks for your response. Well I'll paste the page's source here:

---------------------------aspx----------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>OpenWindow</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
function openwindow(url)
{
lnkNewWindow.href = url;
lnkNewWindow.click();
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<table width="100%" align="center">
<tr>
<td>
<asp:Label id="lblMessage" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Button id="btnPostBack" runat="server"
Text="PostBack"></asp:Button></td>
</tr>
<tr>
<td>
<a id="lnkNewWindow" href="http://www.asp.net" target="_blank"
style="DISPLAY:none"></a>
</td>
</tr>
</table>
</form>
</body>
</HTML>

-----------------------------------aspx.cs page
class----------------------------------------
public class OpenWindow : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button btnPostBack;
protected System.Web.UI.WebControls.Label lblMessage;

private void Page_Load(object sender, System.EventArgs e)
{

}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{

InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.btnPostBack.Click += new
System.EventHandler(this.btnPostBack_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void btnPostBack_Click(object sender, System.EventArgs e)
{
lblMessage.Text = "Button is clicked at: " +
DateTime.Now.ToLongTimeString();
string sb = "<script language='javascript'>openwindow('{0}');</script>";
sb = string.Format(sb,"http://www.microsoft.com");
Page.RegisterStartupScript("startscript",sb);
}
}

-------------------------------------------------------------------

If you have any further questions or anything unclear, please feel free to
post here.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx



Nov 18 '05 #10
A.M
Thanks Steven.

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:U4*************@cpmsftngxa06.phx.gbl...
Hi Ali,

Thanks for your response. Well I'll paste the page's source here:

---------------------------aspx----------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>OpenWindow</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
function openwindow(url)
{
lnkNewWindow.href = url;
lnkNewWindow.click();
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<table width="100%" align="center">
<tr>
<td>
<asp:Label id="lblMessage" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Button id="btnPostBack" runat="server"
Text="PostBack"></asp:Button></td>
</tr>
<tr>
<td>
<a id="lnkNewWindow" href="http://www.asp.net" target="_blank"
style="DISPLAY:none"></a>
</td>
</tr>
</table>
</form>
</body>
</HTML>

-----------------------------------aspx.cs page
class----------------------------------------
public class OpenWindow : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button btnPostBack;
protected System.Web.UI.WebControls.Label lblMessage;

private void Page_Load(object sender, System.EventArgs e)
{

}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{

InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.btnPostBack.Click += new
System.EventHandler(this.btnPostBack_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void btnPostBack_Click(object sender, System.EventArgs e)
{
lblMessage.Text = "Button is clicked at: " +
DateTime.Now.ToLongTimeString();
string sb = "<script language='javascript'>openwindow('{0}');</script>";
sb = string.Format(sb,"http://www.microsoft.com");
Page.RegisterStartupScript("startscript",sb);
}
}

-------------------------------------------------------------------

If you have any further questions or anything unclear, please feel free to
post here.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx


Nov 18 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Noozer | last post by:
When using the WebBrowser control, is it possible to cause popup windows to appear within the WebBrowser control itself instead of a new window? This is what I've written in the NewWindow2 event,...
2
by: Moon | last post by:
Seems I still haven't got the hang of all those window generating code in Javascript. I've got a page with about 15 photo thumbnails. When you click on a thumbnail a new window pops up which shows...
38
by: Shaun McKinnon | last post by:
HI...Here's my problem...I have a popup window that loads when i want it to, but it's not sized properly. I've set the size, but it doesn't seem to work. I've been on 8 different websites to find...
12
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
4
by: Newbie | last post by:
Hello all~ I have got some questions about popup window, hope that someone can help me.. m(_ _)m~thx~ when a popup window appear, can I force users to focus on the popup window "ONLY" that...
3
by: Dan | last post by:
First, I'm sorry if this question has been asked too many times. I'm new to this news group. The question has to do with the use of popup windows in a web page. I have heard that popup windows...
7
by: E Michael Brandt | last post by:
I have been lurking here for some time, and now would like to ask a question of you clever coders: My JustSo PictureWindow 3 Extension for Dreamweaver has stumbled in the face of the new Opera...
3
by: Bob | last post by:
I am trying to create a popup page (to act as a menu) from a parent page. When the parent page (index.jsp) calls my popup function (see below) it will properly open the correct size browser window...
7
by: anthony.turcotte | last post by:
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. Here's the scenario. 1. User accesses...
7
by: YK | last post by:
Hi ! I saw that in Outlook Web Access (OWA) you get small notification window when a new e-mail is received even when the browser window is minimized and it appears at the right corner of the...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.