Wrong window gets the content

Discussion in 'ASP .Net Datagrid Control' started by Geoff, Apr 29, 2005.

  1. Geoff

    Geoff Guest

    I have a datagrid with a button column. When the user clicks a button in the
    datagrid, a PDF should open in a child window. To make this happen, I use
    the grid's ItemDataBound event to add client side code to call a JavaScript
    function to open the PDF window.

    Most of the time it works correctly.

    Maybe one time in ten the parent window gets the PDF and the child window is
    blank. You can tell which is the parent and which is the child because
    toolbars etc. are disabled on the child window.

    Any idea why this happens?

    Much obliged,
    Geoff.
     
    Geoff, Apr 29, 2005
    #1
    1. Advertising

  2. Geoff,

    What javascript code do you make in ItemDataBound event?

    Eliyahu

    "Geoff" <> wrote in message
    news:...
    > I have a datagrid with a button column. When the user clicks a button in

    the
    > datagrid, a PDF should open in a child window. To make this happen, I use
    > the grid's ItemDataBound event to add client side code to call a

    JavaScript
    > function to open the PDF window.
    >
    > Most of the time it works correctly.
    >
    > Maybe one time in ten the parent window gets the PDF and the child window

    is
    > blank. You can tell which is the parent and which is the child because
    > toolbars etc. are disabled on the child window.
    >
    > Any idea why this happens?
    >
    > Much obliged,
    > Geoff.
    >
    >
     
    Eliyahu Goldin, May 1, 2005
    #2
    1. Advertising

  3. Geoff

    Geoff Guest

    Here is the code in the ItemDataBound event handler:

    Private Sub dgControlNumList_ItemDataBound(ByVal sender As Object, ByVal e
    As System.Web.UI.WebControls.DataGridItemEventArgs) Handles
    dgControlNumList.ItemDataBound
    If e.Item.ItemType <> ListItemType.Header And _
    e.Item.ItemType <> ListItemType.Footer And _
    UCase(Request.Params("pAction")) = "VIEW" Then

    Dim btnPDF As LinkButton = e.Item.Cells(0).Controls(0)
    btnPDF.Attributes("onclick") = "OpenPDF('DD562PDF.aspx?pControlNum="
    & _
    DataBinder.Eval(e.Item.DataItem, "ControlNum") & _
    "')"
    End If

    End Sub

    "OpenPDF()" is a JavaScript function copied into the page from a library.
    This is what it looks like:
    function OpenPDF(file) {
    PopUpWin=open(file,'pdfWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no');
    PopUpWin.focus();
    if (PopUpWin.opener == null)
    PopUpWin.opener = self;
    }

    Any clues?
    Geoff.

    "Eliyahu Goldin" <> wrote in message
    news:...
    > Geoff,
    >
    > What javascript code do you make in ItemDataBound event?
    >
    > Eliyahu
    >
    > "Geoff" <> wrote in message
    > news:...
    >> I have a datagrid with a button column. When the user clicks a button in

    > the
    >> datagrid, a PDF should open in a child window. To make this happen, I use
    >> the grid's ItemDataBound event to add client side code to call a

    > JavaScript
    >> function to open the PDF window.
    >>
    >> Most of the time it works correctly.
    >>
    >> Maybe one time in ten the parent window gets the PDF and the child window

    > is
    >> blank. You can tell which is the parent and which is the child because
    >> toolbars etc. are disabled on the child window.
    >>
    >> Any idea why this happens?
    >>
    >> Much obliged,
    >> Geoff.
    >>
    >>

    >
    >
     
    Geoff, May 2, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hazz
    Replies:
    6
    Views:
    50,019
    SkyUCHC
    Jun 9, 2010
  2. Stefan Mueller
    Replies:
    5
    Views:
    548
    Steven Saunderson
    Jul 10, 2006
  3. John Joyce

    gets gets

    John Joyce, Mar 26, 2007, in forum: Ruby
    Replies:
    2
    Views:
    380
    John Joyce
    Mar 26, 2007
  4. John Joyce

    Return of gets gets

    John Joyce, Apr 23, 2007, in forum: Ruby
    Replies:
    0
    Views:
    214
    John Joyce
    Apr 23, 2007
  5. libsfan01
    Replies:
    5
    Views:
    271
    Jeff North
    Dec 20, 2006
Loading...

Share This Page