473,390 Members | 936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to open/popup a seperate IE window

Hello all
I am working on creating a Web application
I am using C# code behind
..NET1.1

Rather than navigate to a new window, I want to open a seperate IE
window when the user clicks a button. Addionally, I want to send a
(query ?) string to the window to be displayed. This will be used to
display additional information for the user to see while still on the
same page.

I thought this would be a common issue, but I do not see any
discussion of it that provides any answers or code.

Thanks everyone

Jeff

Jun 27 '06 #1
8 4911
Jon
You need to use javascript to open a new window. ASP.Net is server side.

You can do something like this on the page to place javascript to execute on
load or you could add an onlick event to the button control with the
javascript popup code
Page.RegisterStartupScript("PopMsg", "<script language=javascript>alert('" +
PopMessage + "');</script>")


"Jeff User" <je*******@hotmail.com> wrote in message
news:t7********************************@4ax.com...
Hello all
I am working on creating a Web application
I am using C# code behind
.NET1.1

Rather than navigate to a new window, I want to open a seperate IE
window when the user clicks a button. Addionally, I want to send a
(query ?) string to the window to be displayed. This will be used to
display additional information for the user to see while still on the
same page.

I thought this would be a common issue, but I do not see any
discussion of it that provides any answers or code.

Thanks everyone

Jeff

Jun 27 '06 #2
Yes, it is common issue, if you have ever done some client-side script.
Server-side code cannot, or is not allowed to, open new browser window.

Typically, you can emit client script code in your ASP.NET code. Here is an
simple example:

private void Page_Load(....)
{
if (!Page.IsPostBack)
{
//Some code...your querystring value may have to be generated
dynamically

string queryString1=SomeProcess1();
string queryString2=SomeProcess2();

Button1.Attributes.Add("onclick","OpenNewWindow('A notherPage.aspx?aaa="
+ queryString1 + "&bbb=" + queryString2 + "');");
}
}

Then, on the page's HTML view, add this javaScript function into
<Head></Head>section

function OpenNewWindow(target)
{
var
win=window.open(target,"TheNewWindow","height=500, width=500,menubar=0");
win.focus();
}

"Jeff User" <je*******@hotmail.com> wrote in message
news:t7********************************@4ax.com...
Hello all
I am working on creating a Web application
I am using C# code behind
.NET1.1

Rather than navigate to a new window, I want to open a seperate IE
window when the user clicks a button. Addionally, I want to send a
(query ?) string to the window to be displayed. This will be used to
display additional information for the user to see while still on the
same page.

I thought this would be a common issue, but I do not see any
discussion of it that provides any answers or code.

Thanks everyone

Jeff

Jun 27 '06 #3
Thanks
This is very close.
I got the script to work, but now, instead of adding the onClick
attribute to a button, instead of that line, can I somehow add those
settings to the Client side "onload" event?

This way I can control when it happens from within my C# code.

I tried typing Page.
but intellisense does not show me an "Attributes" to add to for the
page. I know I could put this in the <body onload="function"> but then
it would load all the time. thats not good.

Thanks again.
Jeff

On Tue, 27 Jun 2006 13:55:02 -0700, "Norman Yuan"
<No*****@NotReal.not> wrote:
Yes, it is common issue, if you have ever done some client-side script.
Server-side code cannot, or is not allowed to, open new browser window.

Typically, you can emit client script code in your ASP.NET code. Here is an
simple example:

private void Page_Load(....)
{
if (!Page.IsPostBack)
{
//Some code...your querystring value may have to be generated
dynamically

string queryString1=SomeProcess1();
string queryString2=SomeProcess2();

Button1.Attributes.Add("onclick","OpenNewWindow('A notherPage.aspx?aaa="
+ queryString1 + "&bbb=" + queryString2 + "');");
}
}

Then, on the page's HTML view, add this javaScript function into
<Head></Head>section

function OpenNewWindow(target)
{
var
win=window.open(target,"TheNewWindow","height=500 ,width=500,menubar=0");
win.focus();
}

"Jeff User" <je*******@hotmail.com> wrote in message
news:t7********************************@4ax.com.. .
Hello all
I am working on creating a Web application
I am using C# code behind
.NET1.1

Rather than navigate to a new window, I want to open a seperate IE
window when the user clicks a button. Addionally, I want to send a
(query ?) string to the window to be displayed. This will be used to
display additional information for the user to see while still on the
same page.

I thought this would be a common issue, but I do not see any
discussion of it that provides any answers or code.

Thanks everyone

Jeff


Jun 27 '06 #4
Make the body tag a server tag:

<body id="Body" runat="server">

Declare the reference to the tag in code behind:

protected HtmlGenericControl Body;

Now you can use the Attributes property to add onload to the tag.

Jeff User wrote:
Thanks
This is very close.
I got the script to work, but now, instead of adding the onClick
attribute to a button, instead of that line, can I somehow add those
settings to the Client side "onload" event?

This way I can control when it happens from within my C# code.

I tried typing Page.
but intellisense does not show me an "Attributes" to add to for the
page. I know I could put this in the <body onload="function"> but then
it would load all the time. thats not good.

Thanks again.
Jeff

On Tue, 27 Jun 2006 13:55:02 -0700, "Norman Yuan"
<No*****@NotReal.not> wrote:
Yes, it is common issue, if you have ever done some client-side script.
Server-side code cannot, or is not allowed to, open new browser window.

Typically, you can emit client script code in your ASP.NET code. Here is an
simple example:

private void Page_Load(....)
{
if (!Page.IsPostBack)
{
//Some code...your querystring value may have to be generated
dynamically

string queryString1=SomeProcess1();
string queryString2=SomeProcess2();

Button1.Attributes.Add("onclick","OpenNewWindow('A notherPage.aspx?aaa="
+ queryString1 + "&bbb=" + queryString2 + "');");
}
}

Then, on the page's HTML view, add this javaScript function into
<Head></Head>section

function OpenNewWindow(target)
{
var
win=window.open(target,"TheNewWindow","height=500, width=500,menubar=0");
win.focus();
}

"Jeff User" <je*******@hotmail.com> wrote in message
news:t7********************************@4ax.com...
Hello all
I am working on creating a Web application
I am using C# code behind
.NET1.1

Rather than navigate to a new window, I want to open a seperate IE
window when the user clicks a button. Addionally, I want to send a
(query ?) string to the window to be displayed. This will be used to
display additional information for the user to see while still on the
same page.

I thought this would be a common issue, but I do not see any
discussion of it that provides any answers or code.

Thanks everyone

Jeff

Jun 27 '06 #5
Jeff,

Yes this was common practise, be aware that there are a lot of popup killers
now going around which prevent that there is an extra window opened from
javascript.

You can as well create a little panel on your normal page that looks like a
popup and ask the user to enter information. (What is very much easier to do
in ASPNET).

Cor

"Jeff User" <je*******@hotmail.com> schreef in bericht
news:t7********************************@4ax.com...
Hello all
I am working on creating a Web application
I am using C# code behind
.NET1.1

Rather than navigate to a new window, I want to open a seperate IE
window when the user clicks a button. Addionally, I want to send a
(query ?) string to the window to be displayed. This will be used to
display additional information for the user to see while still on the
same page.

I thought this would be a common issue, but I do not see any
discussion of it that provides any answers or code.

Thanks everyone

Jeff

Jun 28 '06 #6
Jon
Do you have an eample of the panel method? I might like to try that.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Jeff,

Yes this was common practise, be aware that there are a lot of popup
killers now going around which prevent that there is an extra window
opened from javascript.

You can as well create a little panel on your normal page that looks like
a popup and ask the user to enter information. (What is very much easier
to do in ASPNET).

Cor

"Jeff User" <je*******@hotmail.com> schreef in bericht
news:t7********************************@4ax.com...
Hello all
I am working on creating a Web application
I am using C# code behind
.NET1.1

Rather than navigate to a new window, I want to open a seperate IE
window when the user clicks a button. Addionally, I want to send a
(query ?) string to the window to be displayed. This will be used to
display additional information for the user to see while still on the
same page.

I thought this would be a common issue, but I do not see any
discussion of it that provides any answers or code.

Thanks everyone

Jeff


Jun 28 '06 #7
Jon,

Therefore is not so much sample needed, drag a panel on your form and start
to put other controls on that. Than you can make it visible and hide it any
time you want in your code.

By instance panel1.visible = false 'or true

Cor

"Jon" <ru******@msn.com> schreef in bericht
news:ea*************@TK2MSFTNGP02.phx.gbl...
Do you have an eample of the panel method? I might like to try that.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Jeff,

Yes this was common practise, be aware that there are a lot of popup
killers now going around which prevent that there is an extra window
opened from javascript.

You can as well create a little panel on your normal page that looks like
a popup and ask the user to enter information. (What is very much easier
to do in ASPNET).

Cor

"Jeff User" <je*******@hotmail.com> schreef in bericht
news:t7********************************@4ax.com...
Hello all
I am working on creating a Web application
I am using C# code behind
.NET1.1

Rather than navigate to a new window, I want to open a seperate IE
window when the user clicks a button. Addionally, I want to send a
(query ?) string to the window to be displayed. This will be used to
display additional information for the user to see while still on the
same page.

I thought this would be a common issue, but I do not see any
discussion of it that provides any answers or code.

Thanks everyone

Jeff



Jun 28 '06 #8
Jon
ok, I've done that before. I thought maybe this was something different.
Thanks
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Jon,

Therefore is not so much sample needed, drag a panel on your form and
start to put other controls on that. Than you can make it visible and hide
it any time you want in your code.

By instance panel1.visible = false 'or true

Cor

"Jon" <ru******@msn.com> schreef in bericht
news:ea*************@TK2MSFTNGP02.phx.gbl...
Do you have an eample of the panel method? I might like to try that.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Jeff,

Yes this was common practise, be aware that there are a lot of popup
killers now going around which prevent that there is an extra window
opened from javascript.

You can as well create a little panel on your normal page that looks
like a popup and ask the user to enter information. (What is very much
easier to do in ASPNET).

Cor

"Jeff User" <je*******@hotmail.com> schreef in bericht
news:t7********************************@4ax.com...
Hello all
I am working on creating a Web application
I am using C# code behind
.NET1.1

Rather than navigate to a new window, I want to open a seperate IE
window when the user clicks a button. Addionally, I want to send a
(query ?) string to the window to be displayed. This will be used to
display additional information for the user to see while still on the
same page.

I thought this would be a common issue, but I do not see any
discussion of it that provides any answers or code.

Thanks everyone

Jeff




Jun 28 '06 #9

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

Similar topics

2
by: venkatesh | last post by:
Hi Members, I have used the below mentioned code to open a html page in a new browser. The window size is 200 x 300. In that browser, I've given code to open another browser of the same size....
4
by: Phillip Parr | last post by:
Hello, I have a nice system where someone clicks on a picture to show the full version. This pops up in a window.open box. It works great, the only problem is that if the user clicks a second...
4
by: Dan Cruz | last post by:
Below are two files: Main.asp and Help.asp. I've stripped it down to the 'barest-of bones' so that anyone willing to help can duplicate the problem on their own systems. ***Main.asp*** looks...
23
by: Markus | last post by:
Hi, i have this problem: Sometimes, i can't reproduce, if i click on an small image on the website, the popup _AND_ an other Tab in firefox open. Here are the linkcode: <div...
13
by: ldan | last post by:
Hi everybody, I would not consider myself an expert in javascript - but so far whatever I know, helped me reaching my goals. Recently I started to experience a lot of javascript errors related...
0
by: Steve | last post by:
C# windows I have a simple(ish) enquiry screen. on this I have a search button. I want the search window to popup as a seperate non-modal window, allow the user to search and display the...
1
by: Nevyn Twyll | last post by:
I have a DataList; in the DataList's , I have a LinkButton and a few listboxes. When the LinkButton is pressed, I need to get the ID of the selected item in one of the Listbox controls. Then I...
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.