Updating parent window from popup

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

  1. #1

    Default Updating parent window from popup

    Im relatively new, so please be patient with me...

    I need to update a parent .aspx screen from a popup and close the
    popup. Normally I would use
    'window.opener.location.reload(true);self.close(); ' but i need the
    parent window not to reload or else data that the user has already
    entered will be lost during the IsPostBack.

    I need the 'Apply' button on the popup to trigger the 'Update' button
    on the parent screen. The script ive seen is like this...
    'window.opener.location.Form1.Button1.Click(); self.close();' but I
    get a Javascript Error that reads
    'window.opener.location.Form1.Button1' is null or not an object.

    Any thoughts? Ive seen other posts that say to make sure Button1 on
    Form1 is within the <form> tags and it is. Any help would be
    appreciated!
    mkobus Guest

  2. Similar Questions and Discussions

    1. updating an iframe in parent doc from a popup
      I need to update an iframe contained in a parent doc from within a popup window created from the same parent document. The parent doc (1.cfm): ...
    2. popup back to parent
      How can I open a link from a popup window with a flash animation in it (this animaties contains the link) in the the parent frame that has opened...
    3. can a popup window return data to parent window?
      Is it possible to do the following in php: I want to have a main form open. In the form I want a button that will open a popup window so the user...
    4. pdating parent window from popup....
      hi All: This is the situaton.. I have a treeview with nodes in an aspx page. The node data is coming from DB. when i select a node and click add...
    5. Refresh Parent window from child window causes problems
      Hi All, I have a problem with trying to refresh the parent window from child window in order to update data in the parent window. The sequence...
  3. #2

    Default Re: Updating parent window from popup

    Hi

    window.opener.document.forms[0].myButton.click();

    --
    Best Regards
    Vidar Petursson
    ==============================
    Microsoft Internet Client & Controls MVP
    ==============================
    "mkobus" <turb0dog@hotmail.com> wrote in message
    news:2ca0af54.0307230639.5a2e4a5b@posting.google.c om...
    > Im relatively new, so please be patient with me...
    >
    > I need to update a parent .aspx screen from a popup and close the
    > popup. Normally I would use
    > 'window.opener.location.reload(true);self.close(); ' but i need the
    > parent window not to reload or else data that the user has already
    > entered will be lost during the IsPostBack.
    >
    > I need the 'Apply' button on the popup to trigger the 'Update' button
    > on the parent screen. The script ive seen is like this...
    > 'window.opener.location.Form1.Button1.Click(); self.close();' but I
    > get a Javascript Error that reads
    > 'window.opener.location.Form1.Button1' is null or not an object.
    >
    > Any thoughts? Ive seen other posts that say to make sure Button1 on
    > Form1 is within the <form> tags and it is. Any help would be
    > appreciated!

    Vidar Petursson Guest

  4. #3

    Default Re: Updating parent window from popup

    Maybe something like: window.opener.document.Form1.Button1.click()

    Worse case, create a javascript function in the parent that causes the
    button to click, and call the function from your child window.

    "mkobus" <turb0dog@hotmail.com> wrote in message
    news:2ca0af54.0307230639.5a2e4a5b@posting.google.c om...
    > Im relatively new, so please be patient with me...
    >
    > I need to update a parent .aspx screen from a popup and close the
    > popup. Normally I would use
    > 'window.opener.location.reload(true);self.close(); ' but i need the
    > parent window not to reload or else data that the user has already
    > entered will be lost during the IsPostBack.
    >
    > I need the 'Apply' button on the popup to trigger the 'Update' button
    > on the parent screen. The script ive seen is like this...
    > 'window.opener.location.Form1.Button1.Click(); self.close();' but I
    > get a Javascript Error that reads
    > 'window.opener.location.Form1.Button1' is null or not an object.
    >
    > Any thoughts? Ive seen other posts that say to make sure Button1 on
    > Form1 is within the <form> tags and it is. Any help would be
    > appreciated!

    Marina Guest

  5. #4

    Default Re: Updating parent window from popup

    That's a little different then actually causing the click event of a button.
    If you submit the form, how do you know server side which button submitted
    it? I don't think the right button click event handler would be able to run.

    "Srinivasa Reddy K Ganji" <gksreddy@adsgroup.com> wrote in message
    news:edHU5fTUDHA.2008@TK2MSFTNGP11.phx.gbl...
    > Just out of curiosity.
    >
    > Wouldn't window.opener.document.Form1.submit() work?
    >
    > Reddy
    >
    >
    > "Marina" <zlatkinam@nospam.hotmail.com> wrote in message
    > news:%23VI$JjSUDHA.2148@TK2MSFTNGP11.phx.gbl...
    > > Maybe something like: window.opener.document.Form1.Button1.click()
    > >
    > > Worse case, create a javascript function in the parent that causes the
    > > button to click, and call the function from your child window.
    > >
    > > "mkobus" <turb0dog@hotmail.com> wrote in message
    > > news:2ca0af54.0307230639.5a2e4a5b@posting.google.c om...
    > > > Im relatively new, so please be patient with me...
    > > >
    > > > I need to update a parent .aspx screen from a popup and close the
    > > > popup. Normally I would use
    > > > 'window.opener.location.reload(true);self.close(); ' but i need the
    > > > parent window not to reload or else data that the user has already
    > > > entered will be lost during the IsPostBack.
    > > >
    > > > I need the 'Apply' button on the popup to trigger the 'Update' button
    > > > on the parent screen. The script ive seen is like this...
    > > > 'window.opener.location.Form1.Button1.Click(); self.close();' but I
    > > > get a Javascript Error that reads
    > > > 'window.opener.location.Form1.Button1' is null or not an object.
    > > >
    > > > Any thoughts? Ive seen other posts that say to make sure Button1 on
    > > > Form1 is within the <form> tags and it is. Any help would be
    > > > appreciated!
    > >
    > >
    >
    >

    Marina Guest

  6. #5

    Default Re: Updating parent window from popup - Question for Saravana

    Hi Saravana,

    I have looked at your article and the popup calendar works perfectly.
    Thankyou! But, I am having a problem using it in a datagrid.

    I can place the CalendarUserControl in the ItemTemplate of the datagrid, and
    it works as expected when I am editing a particular row of the grid. But, I
    am having difficulty binding the user control so that it displays the
    current value of that field.

    For example, the datagrid is bound to a table of customers, and one column
    is the customer's birthday. When the page loads, all the birthdays are
    displayed. When I click Edit, I want the CalendarUserControl to show the
    birthday for the customer in that row. But at the moment, it is just blank.

    Any advice you can give would be greatly appreciated.

    Cheers,

    Paul Hobbs

    PS: I downloaded the source code from your article below, and the datagrid
    example doesn't work because the zip file doesn't include the Products.xml
    file. Are you perhaps able to create a datagrid example that uses your
    CalendarUserControl, but where the datagrid is bound to NorthWind.Orders,
    and the CalendarUserControl is bound to Orders.RequiredDate. ;-)



    "Saravana" <saravank@sct.co.in> wrote in message
    news:e#evEpTUDHA.2088@TK2MSFTNGP10.phx.gbl...
    > Check out this article,
    > [url]http://www.microsoft.com/india/msdn/articles/PopupCalendarinASP.aspx[/url]
    >
    > --
    > Saravana
    > Microsoft India Community Star,
    > MCAD,SE,SD,DBA.
    >
    >
    > "mkobus" <turb0dog@hotmail.com> wrote in message
    > news:2ca0af54.0307230639.5a2e4a5b@posting.google.c om...
    > > Im relatively new, so please be patient with me...
    > >
    > > I need to update a parent .aspx screen from a popup and close the
    > > popup. Normally I would use
    > > 'window.opener.location.reload(true);self.close(); ' but i need the
    > > parent window not to reload or else data that the user has already
    > > entered will be lost during the IsPostBack.
    > >
    > > I need the 'Apply' button on the popup to trigger the 'Update' button
    > > on the parent screen. The script ive seen is like this...
    > > 'window.opener.location.Form1.Button1.Click(); self.close();' but I
    > > get a Javascript Error that reads
    > > 'window.opener.location.Form1.Button1' is null or not an object.
    > >
    > > Any thoughts? Ive seen other posts that say to make sure Button1 on
    > > Form1 is within the <form> tags and it is. Any help would be
    > > appreciated!
    >
    >

    Paul Hobbs Guest

  7. #6

    Default Re: Updating parent window from popup - Question for Saravana

    Hi paul,

    I tried in datagrid, it is working fine for me. I didnt send the
    products.xml with my source code if you want i will send it to you. you
    place it in d:\ or change the source code to read that file from specific
    location. Use "TextValue" property of the user control to set the default
    value for Calendar control. If you want more detail on this, get back to me.

    --
    Saravana
    Microsoft India Community Star,
    MCAD,SE,SD,DBA.

    PS: I have sent products.xml to your personal account

    "Paul Hobbs" <paul@mobius.net.au> wrote in message
    news:uZ#FSjlUDHA.484@TK2MSFTNGP09.phx.gbl...
    > Hi Saravana,
    >
    > I have looked at your article and the popup calendar works perfectly.
    > Thankyou! But, I am having a problem using it in a datagrid.
    >
    > I can place the CalendarUserControl in the ItemTemplate of the datagrid,
    and
    > it works as expected when I am editing a particular row of the grid. But,
    I
    > am having difficulty binding the user control so that it displays the
    > current value of that field.
    >
    > For example, the datagrid is bound to a table of customers, and one column
    > is the customer's birthday. When the page loads, all the birthdays are
    > displayed. When I click Edit, I want the CalendarUserControl to show the
    > birthday for the customer in that row. But at the moment, it is just
    blank.
    >
    > Any advice you can give would be greatly appreciated.
    >
    > Cheers,
    >
    > Paul Hobbs
    >
    > PS: I downloaded the source code from your article below, and the
    datagrid
    > example doesn't work because the zip file doesn't include the Products.xml
    > file. Are you perhaps able to create a datagrid example that uses your
    > CalendarUserControl, but where the datagrid is bound to NorthWind.Orders,
    > and the CalendarUserControl is bound to Orders.RequiredDate. ;-)
    >
    >
    >
    > "Saravana" <saravank@sct.co.in> wrote in message
    > news:e#evEpTUDHA.2088@TK2MSFTNGP10.phx.gbl...
    > > Check out this article,
    > > [url]http://www.microsoft.com/india/msdn/articles/PopupCalendarinASP.aspx[/url]
    > >
    > > --
    > > Saravana
    > > Microsoft India Community Star,
    > > MCAD,SE,SD,DBA.
    > >
    > >
    > > "mkobus" <turb0dog@hotmail.com> wrote in message
    > > news:2ca0af54.0307230639.5a2e4a5b@posting.google.c om...
    > > > Im relatively new, so please be patient with me...
    > > >
    > > > I need to update a parent .aspx screen from a popup and close the
    > > > popup. Normally I would use
    > > > 'window.opener.location.reload(true);self.close(); ' but i need the
    > > > parent window not to reload or else data that the user has already
    > > > entered will be lost during the IsPostBack.
    > > >
    > > > I need the 'Apply' button on the popup to trigger the 'Update' button
    > > > on the parent screen. The script ive seen is like this...
    > > > 'window.opener.location.Form1.Button1.Click(); self.close();' but I
    > > > get a Javascript Error that reads
    > > > 'window.opener.location.Form1.Button1' is null or not an object.
    > > >
    > > > Any thoughts? Ive seen other posts that say to make sure Button1 on
    > > > Form1 is within the <form> tags and it is. Any help would be
    > > > appreciated!
    > >
    > >
    >
    >

    Saravana Guest

  8. #7

    Default Re: Updating parent window from popup - Question for Saravana

    Hi Saravana,

    I actually managed to solve this problem by using a technique in another of
    your articles
    ([url]www.microsoft.com/india/msdn/articles/SolutionstoTopFourQuestions.aspx[/url]). I
    simply borrowed the same technique for preselecting an item in a DDL, and
    applied it to the textfield property of the user control, and it works like
    a charm.

    BUT, I have a new error now!

    I have included my code for the ItemDataBound event below:

    This code works fine, until I click the Update button in the datagrid, and
    then I get an error

    Private Sub grdAlbums_ItemDataBound(ByVal sender As Object, ByVal e As
    System.Web.UI.WebControls.DataGridItemEventArgs) Handles
    grdAlbums.ItemDataBound

    If e.Item.ItemType = ListItemType.EditItem Then

    Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView)

    'get current values

    Dim currentArtist As String = CType(drv("ArtistName"), String)

    Dim currentDate As String

    If drv("AlbumReleaseDate") Is DBNull.Value Then

    currentDate = ""

    Else

    currentDate = CType(drv("AlbumReleaseDate"), String)

    End If

    'preselect correct item in DDL

    Dim ddl As DropDownList

    ddl = CType(e.Item.FindControl("lstArtists_edit"), DropDownList)

    ddl.Items.FindByText(currentArtist).Selected = True

    'set value of text field in Calendar control

    Dim ucCal As CalendarUserControl

    ucCal = CType(e.Item.FindControl("calRelDate_edit"), CalendarUserControl)

    ucCal.TextValue = currentDate

    End If

    End Sub

    This code works fine when I click the Edit button. But after I edit a
    field, and click the Update button, I get this error:

    Object reference not set to an instance of an object.

    And the line of code that trips the error is this:
    Line 336: ddl.Items.FindByText(currentArtist).Selected = True

    I think I know why this is happening (when the grid goes back to display
    mode, the DDL object no longer exists), but I don't know how to fix it.

    Thanks for your help!

    Cheers,

    Paul




    "Saravana" <saravank@sct.co.in> wrote in message
    news:#IF6YemUDHA.2204@TK2MSFTNGP10.phx.gbl...
    > Hi paul,
    >
    > I tried in datagrid, it is working fine for me. I didnt send the
    > products.xml with my source code if you want i will send it to you. you
    > place it in d:\ or change the source code to read that file from specific
    > location. Use "TextValue" property of the user control to set the default
    > value for Calendar control. If you want more detail on this, get back to
    me.
    >
    > --
    > Saravana
    > Microsoft India Community Star,
    > MCAD,SE,SD,DBA.
    >
    > PS: I have sent products.xml to your personal account
    >
    > "Paul Hobbs" <paul@mobius.net.au> wrote in message
    > news:uZ#FSjlUDHA.484@TK2MSFTNGP09.phx.gbl...
    > > Hi Saravana,
    > >
    > > I have looked at your article and the popup calendar works perfectly.
    > > Thankyou! But, I am having a problem using it in a datagrid.
    > >
    > > I can place the CalendarUserControl in the ItemTemplate of the datagrid,
    > and
    > > it works as expected when I am editing a particular row of the grid.
    But,
    > I
    > > am having difficulty binding the user control so that it displays the
    > > current value of that field.
    > >
    > > For example, the datagrid is bound to a table of customers, and one
    column
    > > is the customer's birthday. When the page loads, all the birthdays are
    > > displayed. When I click Edit, I want the CalendarUserControl to show
    the
    > > birthday for the customer in that row. But at the moment, it is just
    > blank.
    > >
    > > Any advice you can give would be greatly appreciated.
    > >
    > > Cheers,
    > >
    > > Paul Hobbs
    > >
    > > PS: I downloaded the source code from your article below, and the
    > datagrid
    > > example doesn't work because the zip file doesn't include the
    Products.xml
    > > file. Are you perhaps able to create a datagrid example that uses your
    > > CalendarUserControl, but where the datagrid is bound to
    NorthWind.Orders,
    > > and the CalendarUserControl is bound to Orders.RequiredDate. ;-)
    > >
    > >
    > >
    > > "Saravana" <saravank@sct.co.in> wrote in message
    > > news:e#evEpTUDHA.2088@TK2MSFTNGP10.phx.gbl...
    > > > Check out this article,
    > > > [url]http://www.microsoft.com/india/msdn/articles/PopupCalendarinASP.aspx[/url]
    > > >
    > > > --
    > > > Saravana
    > > > Microsoft India Community Star,
    > > > MCAD,SE,SD,DBA.
    > > >
    > > >
    > > > "mkobus" <turb0dog@hotmail.com> wrote in message
    > > > news:2ca0af54.0307230639.5a2e4a5b@posting.google.c om...
    > > > > Im relatively new, so please be patient with me...
    > > > >
    > > > > I need to update a parent .aspx screen from a popup and close the
    > > > > popup. Normally I would use
    > > > > 'window.opener.location.reload(true);self.close(); ' but i need the
    > > > > parent window not to reload or else data that the user has already
    > > > > entered will be lost during the IsPostBack.
    > > > >
    > > > > I need the 'Apply' button on the popup to trigger the 'Update'
    button
    > > > > on the parent screen. The script ive seen is like this...
    > > > > 'window.opener.location.Form1.Button1.Click(); self.close();' but I
    > > > > get a Javascript Error that reads
    > > > > 'window.opener.location.Form1.Button1' is null or not an object.
    > > > >
    > > > > Any thoughts? Ive seen other posts that say to make sure Button1 on
    > > > > Form1 is within the <form> tags and it is. Any help would be
    > > > > appreciated!
    > > >
    > > >
    > >
    > >
    >
    >

    Paul Hobbs 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