473,722 Members | 2,319 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

No Page_Load event when aspx is in iFrame?

It might be me but...

I dont seem to get a Page_Load event when a opening an ASPX in an iFrame. I
do geta Page_Load event when an item on the ASPX (inside the iFrame) is
clicked but then IsPostBack=Fals e by now!. The ASPX is opened via client
side script (into an iFrame) inside a .HTM file (as ASPX postback causes
problems in a modal internet explorer dialog if not in an iFrame!)

Anyone know how to get around this - i need to examine querystring variables
on 1st load!

Current setup...
MAIN.aspx - contains a link (to popup.htm), it contains client script...
window.showModa lDialog('popup. htm','popup.asp x?v1=" &
txtStartDate.Te xt &
"','status:no;d ialogWidth:250p x;dialogHeight: 250px;dialogHid e:true;help:no; s
croll:no')

in 'popup.htm' - client script sets the src to the 2nd arg
('popup.aspx?v1 ='???') supplied in showModalDialog
<script language='javas cript'>
//<!--
function load()
{
var src = window.dialogAr guments;
if (src) {
document.all.Fr ame1.src = src;
}
}
//-->
</script>
Nov 17 '05 #1
3 4004
I used iframes extensively in a particular project, and the page_load event
fired just fine. And here also, the src of the iframe was assigned at
runtime, not hard coded. Whether or not a page is loaded into an iframe
should not matter.

I think your problem lies elsewhere.

Try using a very simple page, that just does a response.write in the
page_load. Try posting your code here...

"Stevie_mac " <no******@pleas e.com> wrote in message
news:bh******** **@newsg3.svr.p ol.co.uk...
It might be me but...

I dont seem to get a Page_Load event when a opening an ASPX in an iFrame. I do geta Page_Load event when an item on the ASPX (inside the iFrame) is
clicked but then IsPostBack=Fals e by now!. The ASPX is opened via client side script (into an iFrame) inside a .HTM file (as ASPX postback causes
problems in a modal internet explorer dialog if not in an iFrame!)

Anyone know how to get around this - i need to examine querystring variables on 1st load!

Current setup...
MAIN.aspx - contains a link (to popup.htm), it contains client script...
window.showModa lDialog('popup. htm','popup.asp x?v1=" &
txtStartDate.Te xt &
"','status:no;d ialogWidth:250p x;dialogHeight: 250px;dialogHid e:true;help:no; s croll:no')

in 'popup.htm' - client script sets the src to the 2nd arg
('popup.aspx?v1 ='???') supplied in showModalDialog
<script language='javas cript'>
//<!--
function load()
{
var src = window.dialogAr guments;
if (src) {
document.all.Fr ame1.src = src;
}
}
//-->
</script>

Nov 17 '05 #2
Thanks for your response, I did that & response.wrote now.ToString(). What
i've found is that the time was written the 1st time the aspx was shown but
always showed the same time in each following load (Probably something to do
with caching i guess?) Note: the aspx page is loaded by assignment (client
side) to the src property at run time - but within a .htm file - inside a
Modal dialog! Not sure how the page_load isnt called 2nd, 3rd time.

CODE...
*** Main.aspx (inside Page_Load)***
Button1.Attribu tes.Add("onclic k", "var
strReturn=windo w.showModalDial og('popup.htm', 'popup.aspx?v1= " &
txtStartDate.Te xt & "','status: no;
dialogWidth:250 px;dialogHeight :250px;dialogHi de:true;help:no ;scroll:no'); if
(strReturn) document.forms[0].txtStartDate.v alue=strReturn; ")
Button2.Attribu tes.Add("onclic k", "var
strReturn=windo w.showModalDial og('popup.htm', 'popup.aspx?v1= " &
txtEndDate.Text & "','status: no;
dialogWidth:250 px;dialogHeight :250px;dialogHi de:true;help:no ;scroll:no'); if
(strReturn) document.forms[0].txtEndDate.val ue=strReturn;")
*** Popup.htm ***
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>popup</title>
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
<meta name="GENERATOR " content="Micros oft Visual Studio.NET 7.0">
<meta name="ProgId" content="Visual Studio.HTML">
<meta name="Originato r" content="Micros oft Visual Studio.NET 7.0">
<script language='javas cript'>
//<!--
function load()
{
var src = window.dialogAr guments;
if (src) {
document.all.Fr ame1.src = src;
}
}
//-->
</script>
</head>
<body onload='load()' MS_POSITIONING= "GridLayout ">
<iframe id="Frame1" height='100%' width='100%' style="OVERFLOW : auto;
BACKGROUND-COLOR: blue">
</iframe>
</body>
</html>

*** popup.aspx.vb ***
Imports System.Web.UI.H tmlControls.Htm lGenericControl
Public Class PopUp
Inherits System.Web.UI.P age
Protected WithEvents calDate As System.Web.UI.W ebControls.Cale ndar
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If IsPostBack = False Then
If (Request.QueryS tring("v1") & "") <> "" Then
If Microsoft.Visua lBasic.IsDate(R equest.QueryStr ing("v1").ToStr ing()) Then
calDate.Selecte dDate = CDate(Request.Q ueryString("v1" ).ToString())
calDate.Visible Date = calDate.Selecte dDate
End If
End If
End If
End Sub
Private Sub calDate_Selecti onChanged(ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles calDate.Selecti onChanged
AddClientScript ()
End Sub
Private Sub AddClientScript ()
Dim strScript As String = "<script>"
strScript &= "window.returnV alue='" &
calDate.Selecte dDate.ToString( "dd-MMM-yyyy") & "';"
strScript &= "window.close() "
strScript &= "</" & "script>"
RegisterClientS criptBlock("any thing", strScript)
End Sub
End Class

*** popup.aspx ***
<%@ Page Language="vb" AutoEventWireup ="false" Src="PopUp.aspx .vb"
Inherits="PopUp " smartNavigation ="True"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>PopUp</title>
<base target="_self">
<meta url="popup.aspx ">
<meta content="Micros oft Visual Studio .NET 7.1" name="GENERATOR ">
<meta content="Visual Basic .NET 7.1" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
</HEAD>
<body onload="window. focus()" MS_POSITIONING= "GridLayout ">
<form id="Form1" method="post" target="_self" runat="server">
<asp:calendar id="calDate" Runat="server" BackColor="Whit e" Width="100%"
DayNameFormat=" FirstLetter" ForeColor="Blac k" Height="100%" Font-Size="8pt"
Font-Names="Verdana" BorderColor="#9 99999" CellPadding="4" >
<TodayDayStyl e ForeColor="Blac k" BackColor="#CCC CCC"></TodayDayStyle>
<SelectorStyl e BackColor="#CCC CCC"></SelectorStyle>
<NextPrevStyl e VerticalAlign=" Bottom"></NextPrevStyle>
<DayHeaderSty le Font-Size="7pt" Font-Bold="True"
BackColor="#CCC CCC"></DayHeaderStyle>
<SelectedDaySty le Font-Bold="True" ForeColor="Whit e"
BackColor="#666 666"></SelectedDayStyl e>
<TitleStyle Font-Bold="True" BorderColor="Bl ack"
BackColor="#999 999"></TitleStyle>
<WeekendDayStyl e BackColor="#FFF FCC"></WeekendDayStyle >
<OtherMonthDayS tyle ForeColor="#808 080"></OtherMonthDaySt yle>
</asp:calendar>
</form>
</body>
</HTML>
"Marina" <zl*******@nosp am.hotmail.com> wrote in message
news:u2******** ******@TK2MSFTN GP12.phx.gbl...
I used iframes extensively in a particular project, and the page_load event fired just fine. And here also, the src of the iframe was assigned at
runtime, not hard coded. Whether or not a page is loaded into an iframe
should not matter.

I think your problem lies elsewhere.

Try using a very simple page, that just does a response.write in the
page_load. Try posting your code here...

"Stevie_mac " <no******@pleas e.com> wrote in message
news:bh******** **@newsg3.svr.p ol.co.uk...
It might be me but...

I dont seem to get a Page_Load event when a opening an ASPX in an iFrame.
I
do geta Page_Load event when an item on the ASPX (inside the iFrame) is
clicked but then IsPostBack=Fals e by now!. The ASPX is opened via

client
side script (into an iFrame) inside a .HTM file (as ASPX postback causes
problems in a modal internet explorer dialog if not in an iFrame!)

Anyone know how to get around this - i need to examine querystring

variables
on 1st load!

Current setup...
MAIN.aspx - contains a link (to popup.htm), it contains client script...
window.showModa lDialog('popup. htm','popup.asp x?v1=" &
txtStartDate.Te xt &

"','status:no;d ialogWidth:250p x;dialogHeight: 250px;dialogHid e:true;help:no; s croll:no')

in 'popup.htm' - client script sets the src to the 2nd arg
('popup.aspx?v1 ='???') supplied in showModalDialog
<script language='javas cript'>
//<!--
function load()
{
var src = window.dialogAr guments;
if (src) {
document.all.Fr ame1.src = src;
}
}
//-->
</script>


Nov 17 '05 #3
Cant believe i made a TYPO! DOH!
Button1.Attribu tes.Add("onclic k", "var
strReturn=windo w.showModalDial og('popup.htm', 'popup.aspx?v1= ' +
document.forms[0].txtStartDate.v alue ,'status:no;
dialogWidth:250 px;dialogHeight :250px;dialogHi de:true;help:no ;scroll:no'); if
(strReturn) document.forms[0].txtStartDate.v alue=strReturn; ")

Button2.Attribu tes.Add("onclic k", "var
strReturn=windo w.showModalDial og('popup.htm', 'popup.aspx?v1= ' +
document.forms[0].txtEndDate.val ue ,'status:no;
dialogWidth:250 px;dialogHeight :250px;dialogHi de:true;help:no ;scroll:no'); if
(strReturn) document.forms[0].txtEndDate.val ue=strReturn;")

"Stevie_mac " <no******@pleas e.com> wrote in message
news:bh******** **@newsg4.svr.p ol.co.uk...
MAN! i've sussed it! the client script to start things off should read... Button1.Attribu tes.Add("onclic k", "var
strReturn=windo w.showModalDial og('popup.htm', 'popup.aspx?v1= ' +
document.forms[0].txtStartDate.v alue ,'status:no;
dialogWidth:250 px;dialogHeight :250px;dialogHi de:true;help:no ;scroll:no'); if (strReturn) document.forms[0].txtStartDate.v alue=strReturn; ")
Button2.Attribu tes.Add("onclic k", "var
strReturn=windo w.showModalDial og('popup.htm', 'popup.aspx?v1= ' +
document.forms[0].txtStartDate.v alue ,'status:no;
dialogWidth:250 px;dialogHeight :250px;dialogHi de:true;help:no ;scroll:no'); if (strReturn) document.forms[0].txtEndDate.val ue=strReturn;")

Now working fine. Still not sure how DEV environment was not stopping on
break point in Page_Load event in popup.aspx but - it works now. Thanks
again.

<-- SNIP -->
Nov 17 '05 #4

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

Similar topics

2
23504
by: Jeronimo Bertran | last post by:
Hi, I have a page with a very data intensive grid which needs to be automatically refreshed constantly if a change is detected. In order to not refresh the complete page so often, I created an iframe on my page whose html has the refresh meta as follows : <meta http-equiv="refresh" content="10"> The iframe is effectivelyh refreshed every 10 seconds without having the
0
1048
by: Jeremy Howard | last post by:
Hello everyone, Does anyone know if it is possible to raise an event from a user control contained within an IFRAME and then recieve that event back on the page that contains the IFRAME? Below is an outline of what I have right now but for some reason the page containing the iframe never updates the textbox that is assigned text in the event handler. MainPage.aspx --> contains an IFRAME --> contains ControlContainer.aspx --> contains...
2
4420
by: magister | last post by:
Hello I have a default.aspx page with which has an iframe. In the code-behind of the default.aspx page it loads the 'src' attribute of the iframe. The iframe loads another aspx page, but when it loads the Page_Load method is called multiple times. In some situations the page is called twice and in others it is called 4 times.
14
13113
by: V. Jenks | last post by:
I'm a little rusty having not touched .NET for 6 months and I can't remember why Page_Load is happening twice in this code: private void Page_Load(object sender, System.EventArgs e) { //existing session? if (Session == null) { //save local empty order object this._newOrder = Orders.Initialize();
2
7385
by: Sheryl Landon | last post by:
Hi, I'm having a similar issue as the poster Mike whose message I copied below... I have a page with an iframe... when I discover that the session state is no longer valid in the page inside the iframe, I want to redirect the parent page to a login page. Can anyone help me? Thanks, Sheryl "MLibby" <mlibby@nospam.nospam> wrote in message
10
6017
by: Andrew | last post by:
Hi, I have a messagebox that pops up due to an event. I did it in javascript. ie. alert("Time's up. Assessment Ended"); I want to capture the OK and Cancel events of this alert messagebox. My code is in C#/ASP.NET. TIA. Andrew.
1
6954
by: puja | last post by:
hi all, I have this .aspx page for which the Page_load event occurs twice. I found out while debugging. After searching google, I tried checking with Page.Ispostback method and also had "AutoEventWireUp" = false and also run after removing this tag from page directive but still my page_load event gets called twice. I have 3 pages called Search.asp, Processing.aspx and ConfirmSearch.aspx.
17
2840
by: Arpan | last post by:
When a Button is clicked in a Web Form in an ASPX page, the Form will post back to itself. Under such circumstances (i.e. when a Button is clicked), will the Page_Load sub execute first & then will the Click event function of the Button execute or will the Click event function of the Button execute first & then will the Page_Load sub execute? Thanks, Arpan
1
3460
by: epower | last post by:
Hello, I am working on an ASP .NET application in Visual Studio 2005 and running IE7. This application has a page that contains an iframe which loads an .aspx page and hyperlinks that load the iframe with different .aspx pages. The HTML/mark up for the .aspx pages executes every time, but the Page_Load events for the pages never run (on initial load or subsequent loads).
0
8861
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
8739
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
9236
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...
1
9154
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
9088
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
8051
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...
1
6681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5995
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();...
3
2147
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.