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

Force a postback for a page from a different frame

I have a DataGrid that gets filled based on a filter which is defined by
the values that the user selects on several controls. When the page
postbacks after changing the selection on the filter controls, the DataGrid
refreshes itslef. Now, I also need to refresh the DataGrid if I detect
that something "external" has changed (keeping the filter that the user is
using).

For this, I have created a page that partially refreshes itslef in order to
determine if a datagrid must be refreshed. I created a frame within my page

<iframe id='AutoRefresh' src='MonitorAutoRefresh.aspx></iframe>

where MonitorAutoRefresh includes a <meta http-equiv='refresh' content=" +
ResponseTime.ToString() + ">"

MonitorAutorRefresh Page_Load does the following:

// Check if the main grid needs to be refreshed
if (RefreshNeeded())
{
Page.RegisterStartupScript("RefreshParent", "<script
language='javascript'>\r\nRefreshParent()\r\n</script>\r\n");
}

and the script RefreshParent is defined as:

function RefreshParent()
{
window.parent.location.href = window.parent.location.href;
}
The problem I have is that since I am refreshing the parent, I am losing
the state information of the filter controls, and thus the grid gets
refreshed using the default values.

Can I force a postback on the main page to be generated from the
MonitorAutoRefresh panel instead of calling my RefreshParent (which would
preserve the values on the filter controls)? Or, do I need to store the
control values on a session variable in order to preserve them after
calling RefreshParent? Or is there a better solution to what I am trying to
do?

Thanks,

Jeronimo
Nov 19 '05 #1
5 4455
do the a submit instead.

function RefreshParent()
{
window.parent.forms[0].submit();
}

-- bruce (sqwork.com)
"Jeronimo Bertran" <je**************@newsgroup.nospam> wrote in message
news:Xn********************************@207.46.248 .16...
I have a DataGrid that gets filled based on a filter which is defined by
the values that the user selects on several controls. When the page
postbacks after changing the selection on the filter controls, the
DataGrid
refreshes itslef. Now, I also need to refresh the DataGrid if I detect
that something "external" has changed (keeping the filter that the user is
using).

For this, I have created a page that partially refreshes itslef in order
to
determine if a datagrid must be refreshed. I created a frame within my
page

<iframe id='AutoRefresh' src='MonitorAutoRefresh.aspx></iframe>

where MonitorAutoRefresh includes a <meta http-equiv='refresh' content=" +
ResponseTime.ToString() + ">"

MonitorAutorRefresh Page_Load does the following:

// Check if the main grid needs to be refreshed
if (RefreshNeeded())
{
Page.RegisterStartupScript("RefreshParent", "<script
language='javascript'>\r\nRefreshParent()\r\n</script>\r\n");
}

and the script RefreshParent is defined as:

function RefreshParent()
{
window.parent.location.href = window.parent.location.href;
}
The problem I have is that since I am refreshing the parent, I am losing
the state information of the filter controls, and thus the grid gets
refreshed using the default values.

Can I force a postback on the main page to be generated from the
MonitorAutoRefresh panel instead of calling my RefreshParent (which would
preserve the values on the filter controls)? Or, do I need to store the
control values on a session variable in order to preserve them after
calling RefreshParent? Or is there a better solution to what I am trying
to
do?

Thanks,

Jeronimo

Nov 19 '05 #2
Thanks Bruce,

I get the following error :

window.parent.forms.0 is null or not an object.

"Bruce Barker" <br******************@safeco.com> wrote in
news:eh*************@TK2MSFTNGP15.phx.gbl:
do the a submit instead.

function RefreshParent()
{
window.parent.forms[0].submit();
}

-- bruce (sqwork.com)

Nov 19 '05 #3
Hi Jeronimo,

I think the statement Bruce means should be:

window.parent.document.forms[0].submit();

Also, if there're any submit button on the parent aspx page, we can
consider using the

document.getElementById(id) to reference the button element through id
and then call its click() method which can
simulate a submit button's click postback. In fact, sometimes we even put
such a hidden button( set width , height to 1) and use script to invoke its
click() function to do the samething.

Hope also helps.Thanks,
Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #4
Thanks... That worked fine!
Nov 19 '05 #5
You're welcome! :-)

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #6

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

Similar topics

2
by: vk | last post by:
I have a situation where I have 3 frames. The first frame is dynamic and contains javascript variables for use throughout the frameset page and the other frames. Everything works fine...except...
11
by: opt_inf_env | last post by:
Hello everybody, I have created a page consisting of two frames. The second frame is made to display "external" sites (i.e. written not by me, for example www.google.com). But I found that some...
6
by: CW | last post by:
I have written a chat console using DHTML/ASPX. One of the hidden frame continuously refreshes and writes any new messages to a conversation transcript frame. My problem is that I need to keep...
4
by: AIM48 | last post by:
Hi. We have a framework that we work with for our project. So far we have had very good success – basically the frame work wraps many day to day tasks so that they are all included in the...
8
by: walesboy | last post by:
greetings - I have a btnSubmit button with a Handles btnSubmit.click which works great if all the user does is click that button. But, if the user ALSO changes a text box on the page (which...
2
by: Byron Hopp [MCS] | last post by:
How do you force a postback, we have a button to save our users entry, but the button does not have a postback property (like the dropdownlistbox). Is there a way to force a postback? Byron...
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.
11
by: antonyliu2002 | last post by:
I know that this has been asked and answered thousands of times. As a matter of fact, I know that I need to say If Not Page.IsPostBack Then 'Do something End If for things that needs to be...
1
by: =?Utf-8?B?QnJ5YW4=?= | last post by:
Is there a way to force a "traditional" full page postback in AJAX? I have a page with multiple UpdatePanels and I usually call UpdatePanel.Update() to do a partial postback, but I have one...
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...
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"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.