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

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 2482
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*******@discussions.microsoft.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.GetPostBackEventReference(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.myPostBack();

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*******@discussions.microsoft.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****@aspalliance.com> wrote in message
news:%2****************@TK2MSFTNGP12.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.GetPostBackEventReference(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.myPostBack();

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*******@discussions.microsoft.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("yourobjectname","") within your own javascript.

"Jay" <an*******@discussions.microsoft.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.GetPostBackEventReference
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.gewarren.com.delete> wrote in message
news:bp**********@ngspool-d02.news.aol.com...
You may also just be able to just call the javascript postback that asp.net creates using
__doPostBack("yourobjectname","") within your own javascript.

"Jay" <an*******@discussions.microsoft.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
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...
3
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...
1
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...
7
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...
9
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...
6
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...
6
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
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...
4
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. ...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.