473,396 Members | 2,037 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,396 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 4460
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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,...

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.