473,396 Members | 1,995 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,396 software developers and data experts.

Creating a browser window

Is there an easy way to create a new browser window from C# and ASP.NET? I
would just like to have a popup window without any menus or toolbars that
would contain a high-res image. The low-res image would be in the main
window and would have a button that when pressed brings up the "popup"
window that has the high-res image. I would like the window to be re-used
instead of creating yet another popup window if the user navigates to
another low-res image and then hits the button again.
Nov 18 '05 #1
8 1833
Use C# to emit javascript to the client via registerclientscriptblock
"David W. Simmonds" <da***@simmonds.ca> wrote in message
news:niUOb.169644$JQ1.20121@pd7tw1no...
Is there an easy way to create a new browser window from C# and ASP.NET? I
would just like to have a popup window without any menus or toolbars that
would contain a high-res image. The low-res image would be in the main
window and would have a button that when pressed brings up the "popup"
window that has the high-res image. I would like the window to be re-used
instead of creating yet another popup window if the user navigates to
another low-res image and then hits the button again.

Nov 18 '05 #2
I know nothing about java, although I could figure it out. If you have an
example of what you mean it would save me a lot of time.

"Showjumper" <sh*******@grkjashdjkf.com> wrote in message
news:u5**************@TK2MSFTNGP10.phx.gbl...
Use C# to emit javascript to the client via registerclientscriptblock
"David W. Simmonds" <da***@simmonds.ca> wrote in message
news:niUOb.169644$JQ1.20121@pd7tw1no...
Is there an easy way to create a new browser window from C# and ASP.NET? I would just like to have a popup window without any menus or toolbars that would contain a high-res image. The low-res image would be in the main
window and would have a button that when pressed brings up the "popup"
window that has the high-res image. I would like the window to be re-used instead of creating yet another popup window if the user navigates to
another low-res image and then hits the button again.


Nov 18 '05 #3
I added code like this to the Page_Load method:

StringBuilder scriptb = new StringBuilder();
scriptb.Append("<script language=\"javascript\">\n" +
"function NewImageWindow(url)\n" +
"{\n" +

"\twindow.open(url,\"Image\",\"toolbar=no,location =no,directories=no,menubar
=no,resizable=no,scrollbars=yes,width=400,height=3 20\");\n" +
"}\n" +
"/script>\n");
if(!Page.IsClientScriptBlockRegistered("clientNewI mageWindowScript"))
Page.RegisterClientScriptBlock("clientNewImageWind owScript",
scriptb.ToString());

Now I need to add a hyperlink or a button that calls NewImageWindow with a
url in it. How might that be accomplished?

"Showjumper" <sh*******@grkjashdjkf.com> wrote in message
news:u5**************@TK2MSFTNGP10.phx.gbl...
Use C# to emit javascript to the client via registerclientscriptblock
"David W. Simmonds" <da***@simmonds.ca> wrote in message
news:niUOb.169644$JQ1.20121@pd7tw1no...
Is there an easy way to create a new browser window from C# and ASP.NET? I would just like to have a popup window without any menus or toolbars that would contain a high-res image. The low-res image would be in the main
window and would have a button that when pressed brings up the "popup"
window that has the high-res image. I would like the window to be re-used instead of creating yet another popup window if the user navigates to
another low-res image and then hits the button again.


Nov 18 '05 #4
I added the following code to complete the task:

private void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Header)
{
PlaceHolder plLinks = (PlaceHolder)e.Item.FindControl("plLinks");
plLinks.Controls.Add(new LiteralControl(String.Format(
"<A href=\"javascript:NewImageWindow('{0}');\">Click for
high-res image</A>&nbsp;&nbsp;",

"ImageProcessor.aspx?filename="+photos.Tables[0].Rows[nRow]["ImageUrl"].ToSt
ring()+"&width=-1" )));
}
}

The datalist1 control has a PlaceHolder control in the Header Template named
plLinks. When the item is clicked, it calls the NewImageWindow.

Is there a way to change the caption of the window that is created?

"David W. Simmonds" <da***@simmonds.ca> wrote in message
news:dlXOb.171007$JQ1.165404@pd7tw1no...
I added code like this to the Page_Load method:

StringBuilder scriptb = new StringBuilder();
scriptb.Append("<script language=\"javascript\">\n" +
"function NewImageWindow(url)\n" +
"{\n" +

"\twindow.open(url,\"Image\",\"toolbar=no,location =no,directories=no,menubar =no,resizable=no,scrollbars=yes,width=400,height=3 20\");\n" +
"}\n" +
"/script>\n");
if(!Page.IsClientScriptBlockRegistered("clientNewI mageWindowScript"))
Page.RegisterClientScriptBlock("clientNewImageWind owScript",
scriptb.ToString());

Now I need to add a hyperlink or a button that calls NewImageWindow with a
url in it. How might that be accomplished?

"Showjumper" <sh*******@grkjashdjkf.com> wrote in message
news:u5**************@TK2MSFTNGP10.phx.gbl...
Use C# to emit javascript to the client via registerclientscriptblock
"David W. Simmonds" <da***@simmonds.ca> wrote in message
news:niUOb.169644$JQ1.20121@pd7tw1no...
Is there an easy way to create a new browser window from C# and
ASP.NET?
I would just like to have a popup window without any menus or toolbars that would contain a high-res image. The low-res image would be in the main
window and would have a button that when pressed brings up the "popup"
window that has the high-res image. I would like the window to be re-used instead of creating yet another popup window if the user navigates to
another low-res image and then hits the button again.



Nov 18 '05 #5
Hi Dave

I have something like this where I have a Hyperlink control on the web page and in the code-behind I set its NavigateUrl property like the following. I'm poping up the GenLookup.aspx page but You can probably replace that with a .JPG file name

' set up the hyperlink to start the generic looku
HyperLink1.NavigateUrl = "javascript:mywindow=window.open(""GenLookup.aspx" ",""mywindow"",""height=700,width=1000,location=no ,menubar=no,status=no,toolbar=no,scrollbars=yes,re sizable=yes"");mywindow.focus();

If the name 'mywindow' is the same for all links then each will use the same window

Hope that helps
Joh

Nov 18 '05 #6
This is a way better way than I was doing it. Thanks. I am calling an ASPX
page too.

Do you know of a way to change the caption of the popup window?

"John" <an*******@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.com...
Hi Dave,

I have something like this where I have a Hyperlink control on the web page and in the code-behind I set its NavigateUrl property like the
following. I'm poping up the GenLookup.aspx page but You can probably
replace that with a .JPG file name.
' set up the hyperlink to start the generic lookup
HyperLink1.NavigateUrl = "javascript:mywindow=window.open(""GenLookup.aspx" ",""mywindow"",""height=70
0,width=1000,location=no,menubar=no,status=no,tool bar=no,scrollbars=yes,resi
zable=yes"");mywindow.focus();"

If the name 'mywindow' is the same for all links then each will use the same window.
Hope that helps,
John

Nov 18 '05 #7
Well, when I run my pop-up the caption says something lik

GenLokup - Microsoft Internet Explore

The first part is the <title> GenLookup </title> html title in my aspx screen. I'm sure that is a property you can change to Visual Studio or directy in the html code view of you web form. I can't figure out how to get rid of the 'Microsoft Internet Explorer' bit

I looked at the window.open properties and did not see anything there that lets you set the title

John
Nov 18 '05 #8
Hmm, it seems that mine does now too. Could have been a cache issue.

Whatever, it seems to work now.

Thanks a bunch for the assistance.

"John" <an*******@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com...
Well, when I run my pop-up the caption says something like

GenLokup - Microsoft Internet Explorer

The first part is the <title> GenLookup </title> html title in my aspx screen. I'm sure that is a property you can change to Visual Studio or
directy in the html code view of you web form. I can't figure out how to
get rid of the 'Microsoft Internet Explorer' bit.
I looked at the window.open properties and did not see anything there that lets you set the title.
John

Nov 18 '05 #9

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

Similar topics

2
by: PK | last post by:
Hello, I am looking for help on the following. I'm trying to create a custom browser toolbar button that will do a few things. One that I'm trying to do at the moment is just simply return the...
22
by: Tom Moroow | last post by:
Hi, I'm pretty new to javascript and was wondering how you would piece together a variable name and then assign it a value. I want to create a hidden field and assign it a value based on the value...
6
by: Jason Bassford | last post by:
Okay, What I'm trying to do is create two boxes, one on top of the other. The first is a static height, the 2nd, underneath it, should take up the remaining amount of screen space and overflow...
1
by: JavaEnquirer | last post by:
How do you go about creating a new window in javascript that also creates a new browser session. My problem stems from the conflict that arise when launching one java applet from another when each...
24
by: jonathon | last post by:
Hi all, I have a web app with a popup window for entering data. I don't want to access the web every time this window is opened, as most of the app is AJAX. But I can't figure out how to open...
5
by: David Baker | last post by:
Hi all I am very new to ASP.Net. I am trying to create a sniffer for our program. We want our users to click our sniffer and hopefully the sniffer will check their computer against our...
9
by: kermit | last post by:
I keep seeing that you can use the FileSystemObject in either VB script, or Javascript on an aspx page. I added a refrence to the scrrun.dll I added importing namespaces for 'System.Object',...
5
by: John Scott | last post by:
Ok..this a rather odd question/problem. I haven't really found a straight forward answer to how to handle this scenario, so I hope someone here can help. Here it is: I have an application...
12
by: udaypawar | last post by:
I am working on transactional website. I am storing transaction identifier (a unique id) in a cookie, so that I can display transaction history to user. Now a days modern browsers support...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.