No Page_Load event when aspx is in iFrame?

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default 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=False 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.showModalDialog('popup.htm','popup.aspx?v1= " &
    txtStartDate.Text &
    "','status:no;dialogWidth:250px;dialogHeight:250px ;dialogHide: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='javascript'>
    //<!--
    function load()
    {
    var src = window.dialogArguments;
    if (src) {
    document.all.Frame1.src = src;
    }
    }
    //-->
    </script>


    Stevie_mac Guest

  2. Similar Questions and Discussions

    1. Call The Page_load Event
      Hi Dears I want to call the Page_load Event every 5 sec, how can I do that? I have no Ideia what I should do. I put in my web form the Timer...
    2. iframe in aspx page
      I have an aspx page: Main.aspx which has several components that cause a postback. In the page Main.aspx I also have an iframe which contains a...
    3. aspx page in IFRAME.
      I'm calling window.showModalDialog in IE6 to place an IFRAME in a web page dialog box. I'm not abale to select or copy any text in IFRAME. It...
    4. Page_Load event doesn't appear in the trace
      Look at you "web generated code" section of the code behind file. Make sure in the IntializeComponents method there is something like this.Load...
    5. .ascx page_load event
      Hi, I'm curious about the way user control .ascx gets access to the Page_Load event. As custom user control's inheritance is, Object ^ | |...
  3. #2

    Default Re: No Page_Load event when aspx is in iFrame?

    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.email@please.com> wrote in message
    news:bhb4ks$i0p$1@newsg3.svr.pol.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=False 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.showModalDialog('popup.htm','popup.aspx?v1= " &
    > txtStartDate.Text &
    >
    "','status:no;dialogWidth:250px;dialogHeight:250px ;dialogHide: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='javascript'>
    > //<!--
    > function load()
    > {
    > var src = window.dialogArguments;
    > if (src) {
    > document.all.Frame1.src = src;
    > }
    > }
    > //-->
    > </script>
    >
    >

    Marina Guest

  4. #3

    Default Re: No Page_Load event when aspx is in iFrame?

    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.Attributes.Add("onclick", "var
    strReturn=window.showModalDialog('popup.htm','popu p.aspx?v1=" &
    txtStartDate.Text & "','status:no;
    dialogWidth:250px;dialogHeight:250px;dialogHide:tr ue;help:no;scroll:no'); if
    (strReturn) document.forms[0].txtStartDate.value=strReturn;")
    Button2.Attributes.Add("onclick", "var
    strReturn=window.showModalDialog('popup.htm','popu p.aspx?v1=" &
    txtEndDate.Text & "','status:no;
    dialogWidth:250px;dialogHeight:250px;dialogHide:tr ue;help:no;scroll:no'); if
    (strReturn) document.forms[0].txtEndDate.value=strReturn;")


    *** Popup.htm ***
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>popup</title>
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema"
    content="http://schemas.microsoft.com/intellisense/ie5">
    <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
    <meta name="ProgId" content="VisualStudio.HTML">
    <meta name="Originator" content="Microsoft Visual Studio.NET 7.0">
    <script language='javascript'>
    //<!--
    function load()
    {
    var src = window.dialogArguments;
    if (src) {
    document.all.Frame1.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.HtmlControls.HtmlGenericControl
    Public Class PopUp
    Inherits System.Web.UI.Page
    Protected WithEvents calDate As System.Web.UI.WebControls.Calendar
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    If IsPostBack = False Then
    If (Request.QueryString("v1") & "") <> "" Then
    If Microsoft.VisualBasic.IsDate(Request.QueryString(" v1").ToString()) Then
    calDate.SelectedDate = CDate(Request.QueryString("v1").ToString())
    calDate.VisibleDate = calDate.SelectedDate
    End If
    End If
    End If
    End Sub
    Private Sub calDate_SelectionChanged(ByVal sender As System.Object, ByVal e
    As System.EventArgs) Handles calDate.SelectionChanged
    AddClientScript()
    End Sub
    Private Sub AddClientScript()
    Dim strScript As String = "<script>"
    strScript &= "window.returnValue='" &
    calDate.SelectedDate.ToString("dd-MMM-yyyy") & "';"
    strScript &= "window.close()"
    strScript &= "</" & "script>"
    RegisterClientScriptBlock("anything", 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="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5"
    name="vs_targetSchema">
    </HEAD>
    <body onload="window.focus()" MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" target="_self" runat="server">
    <asp:calendar id="calDate" Runat="server" BackColor="White" Width="100%"
    DayNameFormat="FirstLetter" ForeColor="Black" Height="100%" Font-Size="8pt"
    Font-Names="Verdana" BorderColor="#999999" CellPadding="4">
    <TodayDayStyle ForeColor="Black" BackColor="#CCCCCC"></TodayDayStyle>
    <SelectorStyle BackColor="#CCCCCC"></SelectorStyle>
    <NextPrevStyle VerticalAlign="Bottom"></NextPrevStyle>
    <DayHeaderStyle Font-Size="7pt" Font-Bold="True"
    BackColor="#CCCCCC"></DayHeaderStyle>
    <SelectedDayStyle Font-Bold="True" ForeColor="White"
    BackColor="#666666"></SelectedDayStyle>
    <TitleStyle Font-Bold="True" BorderColor="Black"
    BackColor="#999999"></TitleStyle>
    <WeekendDayStyle BackColor="#FFFFCC"></WeekendDayStyle>
    <OtherMonthDayStyle ForeColor="#808080"></OtherMonthDayStyle>
    </asp:calendar>
    </form>
    </body>
    </HTML>


    "Marina" <zlatkinam@nospam.hotmail.com> wrote in message
    news:u22C8MPYDHA.2352@TK2MSFTNGP12.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.email@please.com> wrote in message
    > news:bhb4ks$i0p$1@newsg3.svr.pol.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=False 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.showModalDialog('popup.htm','popup.aspx?v1= " &
    > > txtStartDate.Text &
    > >
    >
    "','status:no;dialogWidth:250px;dialogHeight:250px ;dialogHide: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='javascript'>
    > > //<!--
    > > function load()
    > > {
    > > var src = window.dialogArguments;
    > > if (src) {
    > > document.all.Frame1.src = src;
    > > }
    > > }
    > > //-->
    > > </script>
    > >
    > >
    >
    >

    Stevie_mac Guest

  5. #4

    Default Re: No Page_Load event when aspx is in iFrame?

    Cant believe i made a TYPO! DOH!
    Button1.Attributes.Add("onclick", "var
    strReturn=window.showModalDialog('popup.htm','popu p.aspx?v1=' +
    document.forms[0].txtStartDate.value ,'status:no;
    dialogWidth:250px;dialogHeight:250px;dialogHide:tr ue;help:no;scroll:no'); if
    (strReturn) document.forms[0].txtStartDate.value=strReturn;")

    Button2.Attributes.Add("onclick", "var
    strReturn=window.showModalDialog('popup.htm','popu p.aspx?v1=' +
    document.forms[0].txtEndDate.value ,'status:no;
    dialogWidth:250px;dialogHeight:250px;dialogHide:tr ue;help:no;scroll:no'); if
    (strReturn) document.forms[0].txtEndDate.value=strReturn;")

    "Stevie_mac" <no.email@please.com> wrote in message
    news:bhbi1k$4st$1@newsg4.svr.pol.co.uk...
    > MAN! i've sussed it! the client script to start things off should
    read...
    > Button1.Attributes.Add("onclick", "var
    > strReturn=window.showModalDialog('popup.htm','popu p.aspx?v1=' +
    > document.forms[0].txtStartDate.value ,'status:no;
    > dialogWidth:250px;dialogHeight:250px;dialogHide:tr ue;help:no;scroll:no');
    if
    > (strReturn) document.forms[0].txtStartDate.value=strReturn;")
    > Button2.Attributes.Add("onclick", "var
    > strReturn=window.showModalDialog('popup.htm','popu p.aspx?v1=' +
    > document.forms[0].txtStartDate.value ,'status:no;
    > dialogWidth:250px;dialogHeight:250px;dialogHide:tr ue;help:no;scroll:no');
    if
    > (strReturn) document.forms[0].txtEndDate.value=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 -->


    Stevie_mac Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139