473,786 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1859
Use C# to emit javascript to the client via registerclients criptblock
"David W. Simmonds" <da***@simmonds .ca> wrote in message
news:niUOb.1696 44$JQ1.20121@pd 7tw1no...
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*******@grkj ashdjkf.com> wrote in message
news:u5******** ******@TK2MSFTN GP10.phx.gbl...
Use C# to emit javascript to the client via registerclients criptblock
"David W. Simmonds" <da***@simmonds .ca> wrote in message
news:niUOb.1696 44$JQ1.20121@pd 7tw1no...
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=\"java script\">\n" +
"function NewImageWindow( url)\n" +
"{\n" +

"\twindow.open( url,\"Image\",\ "toolbar=no,loc ation=no,direct ories=no,menuba r
=no,resizable=n o,scrollbars=ye s,width=400,hei ght=320\");\n" +
"}\n" +
"/script>\n");
if(!Page.IsClie ntScriptBlockRe gistered("clien tNewImageWindow Script"))
Page.RegisterCl ientScriptBlock ("clientNewImag eWindowScript",
scriptb.ToStrin g());

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*******@grkj ashdjkf.com> wrote in message
news:u5******** ******@TK2MSFTN GP10.phx.gbl...
Use C# to emit javascript to the client via registerclients criptblock
"David W. Simmonds" <da***@simmonds .ca> wrote in message
news:niUOb.1696 44$JQ1.20121@pd 7tw1no...
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_ItemD ataBound(object sender, DataListItemEve ntArgs e)
{
if (e.Item.ItemTyp e == ListItemType.He ader)
{
PlaceHolder plLinks = (PlaceHolder)e. Item.FindContro l("plLinks");
plLinks.Control s.Add(new LiteralControl( String.Format(
"<A href=\"javascri pt:NewImageWind ow('{0}');\">Cl ick for
high-res image</A>&nbsp;&nbsp;" ,

"ImageProcessor .aspx?filename= "+photos.Ta bles[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.1710 07$JQ1.165404@p d7tw1no...
I added code like this to the Page_Load method:

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

"\twindow.open( url,\"Image\",\ "toolbar=no,loc ation=no,direct ories=no,menuba r =no,resizable=n o,scrollbars=ye s,width=400,hei ght=320\");\n" +
"}\n" +
"/script>\n");
if(!Page.IsClie ntScriptBlockRe gistered("clien tNewImageWindow Script"))
Page.RegisterCl ientScriptBlock ("clientNewImag eWindowScript",
scriptb.ToStrin g());

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*******@grkj ashdjkf.com> wrote in message
news:u5******** ******@TK2MSFTN GP10.phx.gbl...
Use C# to emit javascript to the client via registerclients criptblock
"David W. Simmonds" <da***@simmonds .ca> wrote in message
news:niUOb.1696 44$JQ1.20121@pd 7tw1no...
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.Navi gateUrl = "javascript:myw indow=window.op en(""GenLookup. aspx"",""mywind ow"",""height=7 00,width=1000,l ocation=no,menu bar=no,status=n o,toolbar=no,sc rollbars=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*******@disc ussions.microso ft.com> wrote in message
news:1B******** *************** ***********@mic rosoft.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.Navi gateUrl = "javascript:myw indow=window.op en(""GenLookup. aspx"",""mywind ow"",""height=7 0
0,width=1000,lo cation=no,menub ar=no,status=no ,toolbar=no,scr ollbars=yes,res i
zable=yes"");my window.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*******@disc ussions.microso ft.com> wrote in message
news:9F******** *************** ***********@mic rosoft.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
9717
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 URL of whatever page the user is visiting. I wanted to create a Win32 application using VB.NET. If there is a better way of doing this please let me know. I assume there needs to be some sort of client side code. I was originally leaning...
22
3155
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 of another variable Right now it looks like: ("document.all.SM_MARK_10" + dateNumber + ".value") where dateNumber is an already defined integer. What I want is to say
6
3411
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 with its own vertical scrollbar for any extra content. I've managed to come up with this, which works perfectly in Mozilla, but fails in IE:
1
1411
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 requires a different version of Java, and unfortunately, its the 1.3 version that launches the 1.5 version.
24
3266
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 a new window and build it with DOM rather than having to provide a src. Even a blank.html as src takes time to fetch. How can I create a popup and dynamically add DOM content without any html at all?
5
3177
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 requirements. I would like to ask experts like you to see which items are actually doable with ASP.Net. Below I listed all of the items we are looking for but I can understand if some of the items are impossible to check/sniff. We would like to create a sniffer...
9
3927
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', 'Scripting', 'Scripting.FileSystemObject', and a few others However, when I try to create the fso object I keep receiving an error. 'ActiveX component can't create object: 'Scripting.FileSystemObject'
5
8711
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 that allows users to log in. Each user can have multiple roles within the application. Each role allows the user to access different sections of the app and allows/denies them certain functionality.
12
20740
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 multiple tabs in same window. I am facing a problem when user starts two different transaction in two different tabs in same browser window. I am unable to differentiate between different browser tabs, because which same cookie is getting overwritten, in...
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10357
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9959
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.