473,614 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Initiating a PostBack on a main window from a popup window

Jay
I have a situation where the user clicks on a button in a
DataGrid to launch a popup window via javascript. In the
popup window the user does some things that result in
changes to the underlying database the DataGrid is using
as a data source. When the popup window is closed I want
to refresh the main window -- i.e., cause a postback to
happen.

Is this possible?

From a user-interface perspective the popup window works
very nice. I know that I could perform the same funtion
in the main window but that would be messy.

Jay
Nov 18 '05 #1
5 2505
If you get the window.opener object (also a window) you can use the
window.location .reload before you close the popup window.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Shell/UI
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Jay" <an*******@disc ussions.microso ft.com> wrote in message
news:01******** *************** *****@phx.gbl.. .
I have a situation where the user clicks on a button in a
DataGrid to launch a popup window via javascript. In the
popup window the user does some things that result in
changes to the underlying database the DataGrid is using
as a data source. When the popup window is closed I want
to refresh the main window -- i.e., cause a postback to
happen.

Is this possible?

From a user-interface perspective the popup window works
very nice. I know that I could perform the same funtion
in the main window but that would be messy.

Jay

Nov 18 '05 #2
If the grid on main window is just populated when the page loads, you just
call opener.location .reload() (javascript call) on pop-up and cause it to
reload the main page.

However, if it needs more work, i.e a postback like some button would have
caused it (say Button) and an event to handle, you could have a hidden
button control on main window:

<asp:Button ID="btnHidden" runat="server" />

and then an associated javascript function for it (also on main window)

function myPostBack()
{
<%=Page.GetPost BackEventRefere nce(btnHidden,' ')%>
}

This causes a postback event to be raised in behalf of the Button, when
myPostBAck is called. You could then call this on the pop-up window by:

opener.myPostBa ck();

and it causes the main window to be posted as if btnHidden would have been
clicked. So to handle this click you need to handle btnHidden's Click event.
of course, if you already have a Button (or other control) that does this,
you could cause the postback on behalf of it as well.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"Jay" <an*******@disc ussions.microso ft.com> wrote in message
news:01******** *************** *****@phx.gbl.. .
I have a situation where the user clicks on a button in a
DataGrid to launch a popup window via javascript. In the
popup window the user does some things that result in
changes to the underlying database the DataGrid is using
as a data source. When the popup window is closed I want
to refresh the main window -- i.e., cause a postback to
happen.

Is this possible?

From a user-interface perspective the popup window works
very nice. I know that I could perform the same funtion
in the main window but that would be messy.

Jay

Nov 18 '05 #3
Note that for the Button to be hidden, it should have Visible="False" as
well. :-)

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Teemu Keiski" <jo****@aspalli ance.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
If the grid on main window is just populated when the page loads, you just
call opener.location .reload() (javascript call) on pop-up and cause it to
reload the main page.

However, if it needs more work, i.e a postback like some button would have
caused it (say Button) and an event to handle, you could have a hidden
button control on main window:

<asp:Button ID="btnHidden" runat="server" />

and then an associated javascript function for it (also on main window)

function myPostBack()
{
<%=Page.GetPost BackEventRefere nce(btnHidden,' ')%>
}

This causes a postback event to be raised in behalf of the Button, when
myPostBAck is called. You could then call this on the pop-up window by:

opener.myPostBa ck();

and it causes the main window to be posted as if btnHidden would have been
clicked. So to handle this click you need to handle btnHidden's Click event. of course, if you already have a Button (or other control) that does this,
you could cause the postback on behalf of it as well.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"Jay" <an*******@disc ussions.microso ft.com> wrote in message
news:01******** *************** *****@phx.gbl.. .
I have a situation where the user clicks on a button in a
DataGrid to launch a popup window via javascript. In the
popup window the user does some things that result in
changes to the underlying database the DataGrid is using
as a data source. When the popup window is closed I want
to refresh the main window -- i.e., cause a postback to
happen.

Is this possible?

From a user-interface perspective the popup window works
very nice. I know that I could perform the same funtion
in the main window but that would be messy.

Jay


Nov 18 '05 #4
You may also just be able to just call the javascript postback that asp.net
creates using
__doPostBack("y ourobjectname", "") within your own javascript.

"Jay" <an*******@disc ussions.microso ft.com> wrote in message
news:01******** *************** *****@phx.gbl.. .
I have a situation where the user clicks on a button in a
DataGrid to launch a popup window via javascript. In the
popup window the user does some things that result in
changes to the underlying database the DataGrid is using
as a data source. When the popup window is closed I want
to refresh the main window -- i.e., cause a postback to
happen.

Is this possible?

From a user-interface perspective the popup window works
very nice. I know that I could perform the same funtion
in the main window but that would be messy.

Jay

Nov 18 '05 #5
Definately, but only when there is at least one control at the Page that
requires this JavaScript to exist. A call to Page.GetPostBac kEventReference
ensures that __doPostBack declaration is outputted (that's what the control
needing this declaration calls)

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"vMike" <Mi************ @nospam.gewarre n.com.delete> wrote in message
news:bp******** **@ngspool-d02.news.aol.co m...
You may also just be able to just call the javascript postback that asp.net creates using
__doPostBack("y ourobjectname", "") within your own javascript.

"Jay" <an*******@disc ussions.microso ft.com> wrote in message
news:01******** *************** *****@phx.gbl.. .
I have a situation where the user clicks on a button in a
DataGrid to launch a popup window via javascript. In the
popup window the user does some things that result in
changes to the underlying database the DataGrid is using
as a data source. When the popup window is closed I want
to refresh the main window -- i.e., cause a postback to
happen.

Is this possible?

From a user-interface perspective the popup window works
very nice. I know that I could perform the same funtion
in the main window but that would be messy.

Jay


Nov 18 '05 #6

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

Similar topics

2
4994
by: Ashish | last post by:
Hi All, I have a server runnable textbox control. I also have a server side button object but I hook up javascript to it to show a modal dialog. Upon return it places the value in the textbox (client side script). The problem is that after it places the value, postback occurs and value is lost. I have tried overriding SaveViewState and LoadViewState but it doesnt help (for some super cool reason load is called first after postback rather...
3
4545
by: EMW | last post by:
Hi, Is it possible with VB.NET and Javascript to popup a window, after a buttonclick, in which the user writes some text in a textbox and then when that window is closed with a button, the text is posted back to the aspx program? If it is possible, please let me know some articles about this? thanks,
1
11561
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
7
2592
by: Drew Berkemeyer | last post by:
Hello, We have an application that we have written using ASP.NET. On one of our pages we open a popup window using javascript. The popup window has a save and a cancel button. Both of them are server-side controls and do a postback. While processing on the server we add javascript to the page load (i.e. onload=window.opener.focus(); window.close()). However, the window.close() command does not close the IE popup window. This happens...
9
3327
by: John Walker | last post by:
Hi, I have a datagrid with a radiobutton template column, with AutoPostBack set to TRUE. When the user clicks on a radiobutton the application will PostBack, and in the PostBack there will be certain logic performed, and the dataview will be re-binded to the datagrid. There turns out to be about 2-5 seconds delay between the time the user clicks the radiobutton and when the page is completely re-loaded. During this time the user may try...
6
2428
by: SkeanDu | last post by:
Ok, here is my problem. I have an aspx page that displays a databound datagrid and in one of the datagrid column headers I have an image that when clicked opens up a modal web dialog (another aspx page). >From this dialog I want the users to be able to select a filter item from a databound combobox and click on the apply button on the web dialog that will then disappear and the filtered data will be displayed on my datagrid.
6
2404
by: Shawn | last post by:
Any ideas how I can have a button click on one open page force a postback on a different page.
2
20627
by: Rob Roberts | last post by:
Is there any way to prevent a ButtonField in a GridView from doing a postback when clicked? I want to use my own onclick handler to call window.open('SomePage.aspx') to display a page in a new browser window when the button is clicked. I tried doing this in the RowCommand postback event by doing this in the event handler: Response.Write("<script>window.open('SomePage.aspx');</script>");
4
8192
by: Frank | last post by:
Hello everyone, I have a problem that the window.opener variable is lost once my popup page has a postback. On multiple pages they address this problem but I cannot find a correct answer. This is my situation: I have a main page which shows invoices. When a user clicks on the invoices they get a popup where they can alter the invoice which uses
0
8197
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
8142
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
8640
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
8589
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8443
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
7114
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...
0
5548
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
4058
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...
0
4136
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.