473,769 Members | 2,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Closing a window using a ASP:ImageButton

Hi all,

I need to be able to cause the following chain of events after clicking an
asp:button but I don't know how to do it. I'd really appreciate any advice
on this or alternative approaches:

The window in question is a popup asking the user to provide some details.
The primary window is still open in the background

1. Button on popup clicked
2. Information on form saved to database
3. Popup closes
4. Primary window refreshes or is redirected

I really hope someone can advise on how to achieve this

Thanks all

tce
Nov 19 '05 #1
3 1739
You'd have to out put some javascript to your page after its postback.
Use the Page.RegisterSt artupScript method.

popup codebehind:

void button_onclick( ...)
{
// add code to save data to DB

yourjavascript = "<script language='javas cript'>";
yourjavascript += "self.parent.lo cation = self.parent.loc ation.href;
// this will refresh your parent window.";
yourjavascript += "self.close (); // close popup";
yourjavascript += "</script>"
Page.RegisterSt artupScript( yourJavascript) :
}
"thechaosengine " <none> wrote in message
news:10******** *************@n ews.microsoft.c om...
Hi all,

I need to be able to cause the following chain of events after clicking an
asp:button but I don't know how to do it. I'd really appreciate any advice
on this or alternative approaches:

The window in question is a popup asking the user to provide some details.
The primary window is still open in the background

1. Button on popup clicked
2. Information on form saved to database
3. Popup closes
4. Primary window refreshes or is redirected

I really hope someone can advise on how to achieve this

Thanks all

tce

Nov 19 '05 #2
In the image click event, after saving the information, do something like:

dim script as string = "<script language=""java script"">" &
System.Environm ent.NewLine & "self.close ();" & System.Environm ent.NewLine &
"</script>"
Page.RegisterSt artupScript("Po pupClose", script)
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"thechaosengine " <none> wrote in message
news:10******** *************@n ews.microsoft.c om...
Hi all,

I need to be able to cause the following chain of events after clicking an
asp:button but I don't know how to do it. I'd really appreciate any advice
on this or alternative approaches:

The window in question is a popup asking the user to provide some details.
The primary window is still open in the background

1. Button on popup clicked
2. Information on form saved to database
3. Popup closes
4. Primary window refreshes or is redirected

I really hope someone can advise on how to achieve this

Thanks all

tce

Nov 19 '05 #3
oppss..I forgot the parent refresh in mind :) well, now you have the c# and
vb.net version...just add mort's self.parent.loc ation... to my script
variable if you need it in vb.net

On the flip side, RegisterStartup Script always takes 2 parameters...th e
first being the key...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"mortb" <mortb1<noospam <@hotmail.com > wrote in message
news:uS******** ********@TK2MSF TNGP15.phx.gbl. ..
You'd have to out put some javascript to your page after its postback.
Use the Page.RegisterSt artupScript method.

popup codebehind:

void button_onclick( ...)
{
// add code to save data to DB

yourjavascript = "<script language='javas cript'>";
yourjavascript += "self.parent.lo cation =
self.parent.loc ation.href; // this will refresh your parent window.";
yourjavascript += "self.close (); // close popup";
yourjavascript += "</script>"
Page.RegisterSt artupScript( yourJavascript) :
}
"thechaosengine " <none> wrote in message
news:10******** *************@n ews.microsoft.c om...
Hi all,

I need to be able to cause the following chain of events after clicking
an asp:button but I don't know how to do it. I'd really appreciate any
advice on this or alternative approaches:

The window in question is a popup asking the user to provide some
details. The primary window is still open in the background

1. Button on popup clicked
2. Information on form saved to database
3. Popup closes
4. Primary window refreshes or is redirected

I really hope someone can advise on how to achieve this

Thanks all

tce


Nov 19 '05 #4

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

Similar topics

1
3045
by: JIM | last post by:
Hello, Does anyone knows how to set the visible property of an asp:Imagebutton to true with javascript I've the following declared : <asp:ImageButton Id="tstImage" runat="server" visible="False" />
1
2368
by: Michael Evanchik | last post by:
The following tag works fine in internet explorer, but in mozilla the image is not sized and left at its actualy size. Anyone know why? I though asp.net works on any browswer. <asp:imagebutton id="Image1" Runat="server" onclick="enteraccount" height="90" width="120" ImageUrl="images/account.gif" />
2
2839
by: Alan Scott | last post by:
I am using the following code to redirect users to another webpage when they click on an image: Response.Redirect("login.aspx"); The code works. However, I have frames setup and would like the form to be display in the main window, not the side panel. Is there a way to do this?
1
427
by: Ren | last post by:
I am creating a profile page which on load only has the images of each person (as an ImageButton). When the user clicks on a picture, the text of a hidden label is displayed with the text of that person's profile. I'm trying to get it so that when a picture is clicked, the page jumps to a bookmark that points to the profile text. However, on postback, it's just staying at the top of the page. Is there anyway that this can be done? ...
5
1719
by: Alex D. | last post by:
Does any body knows how to link an asp:textbox to an asp:imagebutton, both inside a User Control in asp.net 2 beta 2? So when a user enter some text in the textbox and press the "Enter" key the corresponding button click event is launched? Tnx.
13
7448
by: tperri | last post by:
I have an HTML table with several fields like this: <A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood" ImageUrl="images\buttons\btn-food-i.gif" runat="server"></asp:imagebutton></A> When the user sees these buttons, they will currently be on the savings.aspx?category=whatever page, and when they click another button to look at other categories, all the links I have around these buttons direct to their various categories.
1
1281
by: Shapper | last post by:
Hello, I have 2 Asp:ImageButton in my .aspx file and I have the function "Run" in m .aspx.vb file. I need to run this function when one of the ImageButtons is pressed but I need to know which one was pressed. How can I do this? I was trying with commandname and oncommand properties of ASP:ImageButton but I was not able to make this work.
2
4488
by: Dariusz Tomon | last post by:
Hi I got task to make my application much more attractive :( First of all I have to add hover (mouseover) effect to several buttons - imagebuttons - I only know manner with Java Script - but it does not work with ASPNET objects. Any ideas? Darek
0
2270
by: Stan SR | last post by:
Hi, I need to customize a pargertemplate with these items a arrow to go back to the 1rst page a arrow for the previous page a dropdownlist with the page indexes a arrow for the new page a arrow for the last page. The dropdownlist function is okay, but I m blocked with the arrows
0
9586
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
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10210
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...
1
9990
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
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
6672
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
5298
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...
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2814
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.