PopUp Window from Codebehind

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rathtap

    PopUp Window from Codebehind

    I want to popup a window from my codebehind. The reason is that during
    the postback the code needs to do some validations and to build the
    arguments that are passed in the url. How can I achieve this
    functionality?
    The reason I do not want to use Response.Redire ct is because when the
    user comes back to the first page, all the selections that were
    made(which are the arguments) disappear.
  • Curt_C [MVP]

    #2
    Re: PopUp Window from Codebehind

    there is no way to do that directly from code-behind, it has to pass to a
    clientside call

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    Site: http://www.Darkfalz.com
    Blog: http://blog.Darkfalz.com


    "Rathtap" <amcniw@yahoo.c om> wrote in message
    news:b21a5958.0 409090743.56e95 c28@posting.goo gle.com...[color=blue]
    >I want to popup a window from my codebehind. The reason is that during
    > the postback the code needs to do some validations and to build the
    > arguments that are passed in the url. How can I achieve this
    > functionality?
    > The reason I do not want to use Response.Redire ct is because when the
    > user comes back to the first page, all the selections that were
    > made(which are the arguments) disappear.[/color]


    Comment

    • Matt

      #3
      Re: PopUp Window from Codebehind

      I saw Frank Gimberg do something similar to this in a demo once a year or
      two ago. You can contact him at frank@prosoft-sys.com


      "Rathtap" <amcniw@yahoo.c om> wrote in message
      news:b21a5958.0 409090743.56e95 c28@posting.goo gle.com...[color=blue]
      > I want to popup a window from my codebehind. The reason is that during
      > the postback the code needs to do some validations and to build the
      > arguments that are passed in the url. How can I achieve this
      > functionality?
      > The reason I do not want to use Response.Redire ct is because when the
      > user comes back to the first page, all the selections that were
      > made(which are the arguments) disappear.[/color]


      Comment

      • bruce barker

        #4
        Re: PopUp Window from Codebehind

        while you can emit javascript to do this, any popup blocker will stop it.

        -- bruce (sqlwork.com)


        "Rathtap" <amcniw@yahoo.c om> wrote in message
        news:b21a5958.0 409090743.56e95 c28@posting.goo gle.com...[color=blue]
        > I want to popup a window from my codebehind. The reason is that during
        > the postback the code needs to do some validations and to build the
        > arguments that are passed in the url. How can I achieve this
        > functionality?
        > The reason I do not want to use Response.Redire ct is because when the
        > user comes back to the first page, all the selections that were
        > made(which are the arguments) disappear.[/color]


        Comment

        • Kevin Spencer

          #5
          Re: PopUp Window from Codebehind

          You have a couple of options. One is to generate a JavaScript that opens the
          new window. As has been pointed out, popup blockers will stop it. However,
          another approach (also using JavaScript) is to programmaticall y click a
          (hidden) hyperlink that opens in a new window, thus avoiding the popup
          blockers. However, you wil have no control over the new window's size and
          configuration.

          --
          HTH,
          Kevin Spencer
          ..Net Developer
          Microsoft MVP
          I get paid good money to
          solve puzzles for a living

          "Rathtap" <amcniw@yahoo.c om> wrote in message
          news:b21a5958.0 409090743.56e95 c28@posting.goo gle.com...[color=blue]
          > I want to popup a window from my codebehind. The reason is that during
          > the postback the code needs to do some validations and to build the
          > arguments that are passed in the url. How can I achieve this
          > functionality?
          > The reason I do not want to use Response.Redire ct is because when the
          > user comes back to the first page, all the selections that were
          > made(which are the arguments) disappear.[/color]


          Comment

          • Kevin Spencer

            #6
            Re: PopUp Window from Codebehind

            Forgive me. I spoke too quickly Upon reflection, I realized that JavaScript
            can't click a hyperlink. Oh well. I can't think of any other way to open a
            new browser window that won't be foiled by popup blockers. Best to try
            another route.

            --
            HTH,
            Kevin Spencer
            ..Net Developer
            Microsoft MVP
            I get paid good money to
            solve puzzles for a living

            "bruce barker" <nospam_brubar@ safeco.com> wrote in message
            news:ed96JxolEH A.3544@TK2MSFTN GP15.phx.gbl...[color=blue]
            > while you can emit javascript to do this, any popup blocker will stop it.
            >
            > -- bruce (sqlwork.com)
            >
            >
            > "Rathtap" <amcniw@yahoo.c om> wrote in message
            > news:b21a5958.0 409090743.56e95 c28@posting.goo gle.com...[color=green]
            > > I want to popup a window from my codebehind. The reason is that during
            > > the postback the code needs to do some validations and to build the
            > > arguments that are passed in the url. How can I achieve this
            > > functionality?
            > > The reason I do not want to use Response.Redire ct is because when the
            > > user comes back to the first page, all the selections that were
            > > made(which are the arguments) disappear.[/color]
            >
            >[/color]


            Comment

            • Greg Burns

              #7
              Re: PopUp Window from Codebehind

              Kevin,

              This has been bother me for quite awhile.

              Why does my code for a pop-up window from my app not get blocked by IE SP2
              pop-up blocker or the Google toolbar? (Yet some other pop-up blockers that
              my users have installed does block it)

              (No exceptions have been made in IE's Pop-up blocker settings either)

              Private Function openNewWindow(B yVal url As String, ByVal windowName As
              String, ByVal features As String) As String

              ' url parameter must be enclosed in single quotes!!!

              Dim sb As System.Text.Str ingBuilder = New System.Text.Str ingBuilder
              sb.Append("java script:var " & windowName & " = window.open(" + url +
              ",'" + windowName + "','" & features + "');" & windowName & ".focus();" )

              Return sb.ToString()
              End Function

              The code is not really important here. I think I might be missing the big
              picture; are pop-up allowed if they are user initiated. (i.e. a user click a
              hyperlink that causes the pop-up)?

              BTW, here is a great link I saw yesterday to encapsulate creating a pop-up
              into a class:



              Greg

              "Kevin Spencer" <kspencer@takem pis.com> wrote in message
              news:Oe65wZplEH A.324@TK2MSFTNG P11.phx.gbl...[color=blue]
              > Forgive me. I spoke too quickly Upon reflection, I realized that
              > JavaScript
              > can't click a hyperlink. Oh well. I can't think of any other way to open a
              > new browser window that won't be foiled by popup blockers. Best to try
              > another route.
              >
              > --
              > HTH,
              > Kevin Spencer
              > .Net Developer
              > Microsoft MVP
              > I get paid good money to
              > solve puzzles for a living
              >
              > "bruce barker" <nospam_brubar@ safeco.com> wrote in message
              > news:ed96JxolEH A.3544@TK2MSFTN GP15.phx.gbl...[color=green]
              >> while you can emit javascript to do this, any popup blocker will stop it.
              >>
              >> -- bruce (sqlwork.com)
              >>
              >>
              >> "Rathtap" <amcniw@yahoo.c om> wrote in message
              >> news:b21a5958.0 409090743.56e95 c28@posting.goo gle.com...[color=darkred]
              >> > I want to popup a window from my codebehind. The reason is that during
              >> > the postback the code needs to do some validations and to build the
              >> > arguments that are passed in the url. How can I achieve this
              >> > functionality?
              >> > The reason I do not want to use Response.Redire ct is because when the
              >> > user comes back to the first page, all the selections that were
              >> > made(which are the arguments) disappear.[/color]
              >>
              >>[/color]
              >
              >[/color]


              Comment

              • Curt_C [MVP]

                #8
                Re: PopUp Window from Codebehind

                It's not a popup if the user clicked it, it's a link. Popups are usually
                designated as loaded from within the page without the user instructing it to
                do so.

                --
                Curt Christianson
                Owner/Lead Developer, DF-Software
                Site: http://www.Darkfalz.com
                Blog: http://blog.Darkfalz.com


                "Greg Burns" <greg_burns@DON T_SPAM_ME_hotma il.com> wrote in message
                news:O7hQv9plEH A.2612@TK2MSFTN GP15.phx.gbl...[color=blue]
                > Kevin,
                >
                > This has been bother me for quite awhile.
                >
                > Why does my code for a pop-up window from my app not get blocked by IE SP2
                > pop-up blocker or the Google toolbar? (Yet some other pop-up blockers
                > that my users have installed does block it)
                >
                > (No exceptions have been made in IE's Pop-up blocker settings either)
                >
                > Private Function openNewWindow(B yVal url As String, ByVal windowName As
                > String, ByVal features As String) As String
                >
                > ' url parameter must be enclosed in single quotes!!!
                >
                > Dim sb As System.Text.Str ingBuilder = New System.Text.Str ingBuilder
                > sb.Append("java script:var " & windowName & " = window.open(" + url
                > + ",'" + windowName + "','" & features + "');" & windowName & ".focus();" )
                >
                > Return sb.ToString()
                > End Function
                >
                > The code is not really important here. I think I might be missing the big
                > picture; are pop-up allowed if they are user initiated. (i.e. a user click
                > a hyperlink that causes the pop-up)?
                >
                > BTW, here is a great link I saw yesterday to encapsulate creating a pop-up
                > into a class:
                >
                > http://www.dotnet2themax.com/ShowCon...9-6f952f31491a
                >
                > Greg
                >
                > "Kevin Spencer" <kspencer@takem pis.com> wrote in message
                > news:Oe65wZplEH A.324@TK2MSFTNG P11.phx.gbl...[color=green]
                >> Forgive me. I spoke too quickly Upon reflection, I realized that
                >> JavaScript
                >> can't click a hyperlink. Oh well. I can't think of any other way to open
                >> a
                >> new browser window that won't be foiled by popup blockers. Best to try
                >> another route.
                >>
                >> --
                >> HTH,
                >> Kevin Spencer
                >> .Net Developer
                >> Microsoft MVP
                >> I get paid good money to
                >> solve puzzles for a living
                >>
                >> "bruce barker" <nospam_brubar@ safeco.com> wrote in message
                >> news:ed96JxolEH A.3544@TK2MSFTN GP15.phx.gbl...[color=darkred]
                >>> while you can emit javascript to do this, any popup blocker will stop
                >>> it.
                >>>
                >>> -- bruce (sqlwork.com)
                >>>
                >>>
                >>> "Rathtap" <amcniw@yahoo.c om> wrote in message
                >>> news:b21a5958.0 409090743.56e95 c28@posting.goo gle.com...
                >>> > I want to popup a window from my codebehind. The reason is that during
                >>> > the postback the code needs to do some validations and to build the
                >>> > arguments that are passed in the url. How can I achieve this
                >>> > functionality?
                >>> > The reason I do not want to use Response.Redire ct is because when the
                >>> > user comes back to the first page, all the selections that were
                >>> > made(which are the arguments) disappear.
                >>>
                >>>[/color]
                >>
                >>[/color]
                >
                >[/color]


                Comment

                • Greg Burns

                  #9
                  Re: PopUp Window from Codebehind

                  I don't think I expressed myself well.

                  For example, I have button (being a hyperlink button or push button) in a
                  datagrid. When the user selects it, is causes a postback. In the post back
                  code, I am building js window.open function that I append to the output of
                  the page with Page.RegisterSt artupScript. (I am dynamically building the
                  querystring). How does/should a pop-up blocker treat this situation? My
                  pop-up blockers are allowing it, some or not.

                  Greg


                  "Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
                  news:uZvKKQqlEH A.2680@TK2MSFTN GP15.phx.gbl...[color=blue]
                  > It's not a popup if the user clicked it, it's a link. Popups are usually
                  > designated as loaded from within the page without the user instructing it
                  > to do so.
                  >
                  > --
                  > Curt Christianson
                  > Owner/Lead Developer, DF-Software
                  > Site: http://www.Darkfalz.com
                  > Blog: http://blog.Darkfalz.com
                  >
                  >
                  > "Greg Burns" <greg_burns@DON T_SPAM_ME_hotma il.com> wrote in message
                  > news:O7hQv9plEH A.2612@TK2MSFTN GP15.phx.gbl...[color=green]
                  >> Kevin,
                  >>
                  >> This has been bother me for quite awhile.
                  >>
                  >> Why does my code for a pop-up window from my app not get blocked by IE
                  >> SP2 pop-up blocker or the Google toolbar? (Yet some other pop-up
                  >> blockers that my users have installed does block it)
                  >>
                  >> (No exceptions have been made in IE's Pop-up blocker settings either)
                  >>
                  >> Private Function openNewWindow(B yVal url As String, ByVal windowName
                  >> As String, ByVal features As String) As String
                  >>
                  >> ' url parameter must be enclosed in single quotes!!!
                  >>
                  >> Dim sb As System.Text.Str ingBuilder = New
                  >> System.Text.Str ingBuilder
                  >> sb.Append("java script:var " & windowName & " = window.open(" + url
                  >> + ",'" + windowName + "','" & features + "');" & windowName &
                  >> ".focus();" )
                  >>
                  >> Return sb.ToString()
                  >> End Function
                  >>
                  >> The code is not really important here. I think I might be missing the
                  >> big picture; are pop-up allowed if they are user initiated. (i.e. a user
                  >> click a hyperlink that causes the pop-up)?
                  >>
                  >> BTW, here is a great link I saw yesterday to encapsulate creating a
                  >> pop-up into a class:
                  >>
                  >> http://www.dotnet2themax.com/ShowCon...9-6f952f31491a
                  >>
                  >> Greg
                  >>
                  >> "Kevin Spencer" <kspencer@takem pis.com> wrote in message
                  >> news:Oe65wZplEH A.324@TK2MSFTNG P11.phx.gbl...[color=darkred]
                  >>> Forgive me. I spoke too quickly Upon reflection, I realized that
                  >>> JavaScript
                  >>> can't click a hyperlink. Oh well. I can't think of any other way to open
                  >>> a
                  >>> new browser window that won't be foiled by popup blockers. Best to try
                  >>> another route.
                  >>>
                  >>> --
                  >>> HTH,
                  >>> Kevin Spencer
                  >>> .Net Developer
                  >>> Microsoft MVP
                  >>> I get paid good money to
                  >>> solve puzzles for a living
                  >>>
                  >>> "bruce barker" <nospam_brubar@ safeco.com> wrote in message
                  >>> news:ed96JxolEH A.3544@TK2MSFTN GP15.phx.gbl...
                  >>>> while you can emit javascript to do this, any popup blocker will stop
                  >>>> it.
                  >>>>
                  >>>> -- bruce (sqlwork.com)
                  >>>>
                  >>>>
                  >>>> "Rathtap" <amcniw@yahoo.c om> wrote in message
                  >>>> news:b21a5958.0 409090743.56e95 c28@posting.goo gle.com...
                  >>>> > I want to popup a window from my codebehind. The reason is that
                  >>>> > during
                  >>>> > the postback the code needs to do some validations and to build the
                  >>>> > arguments that are passed in the url. How can I achieve this
                  >>>> > functionality?
                  >>>> > The reason I do not want to use Response.Redire ct is because when the
                  >>>> > user comes back to the first page, all the selections that were
                  >>>> > made(which are the arguments) disappear.
                  >>>>
                  >>>>
                  >>>
                  >>>[/color]
                  >>
                  >>[/color]
                  >
                  >[/color]


                  Comment

                  • Kevin Spencer

                    #10
                    Re: PopUp Window from Codebehind

                    Hi Gregg,

                    Windows XP Service Pack 2 includes a Popup blocker. I can't tell you
                    anything about other popup blockers, but here is all the info about Windows
                    XP Service Pack 2 for developers:



                    --
                    HTH,
                    Kevin Spencer
                    ..Net Developer
                    Microsoft MVP
                    I get paid good money to
                    solve puzzles for a living

                    "Greg Burns" <greg_burns@DON T_SPAM_ME_hotma il.com> wrote in message
                    news:#iOsefqlEH A.3392@TK2MSFTN GP15.phx.gbl...[color=blue]
                    > I don't think I expressed myself well.
                    >
                    > For example, I have button (being a hyperlink button or push button) in a
                    > datagrid. When the user selects it, is causes a postback. In the post[/color]
                    back[color=blue]
                    > code, I am building js window.open function that I append to the output of
                    > the page with Page.RegisterSt artupScript. (I am dynamically building the
                    > querystring). How does/should a pop-up blocker treat this situation? My
                    > pop-up blockers are allowing it, some or not.
                    >
                    > Greg
                    >
                    >
                    > "Curt_C [MVP]" <software_AT_da rkfalz.com> wrote in message
                    > news:uZvKKQqlEH A.2680@TK2MSFTN GP15.phx.gbl...[color=green]
                    > > It's not a popup if the user clicked it, it's a link. Popups are usually
                    > > designated as loaded from within the page without the user instructing[/color][/color]
                    it[color=blue][color=green]
                    > > to do so.
                    > >
                    > > --
                    > > Curt Christianson
                    > > Owner/Lead Developer, DF-Software
                    > > Site: http://www.Darkfalz.com
                    > > Blog: http://blog.Darkfalz.com
                    > >
                    > >
                    > > "Greg Burns" <greg_burns@DON T_SPAM_ME_hotma il.com> wrote in message
                    > > news:O7hQv9plEH A.2612@TK2MSFTN GP15.phx.gbl...[color=darkred]
                    > >> Kevin,
                    > >>
                    > >> This has been bother me for quite awhile.
                    > >>
                    > >> Why does my code for a pop-up window from my app not get blocked by IE
                    > >> SP2 pop-up blocker or the Google toolbar? (Yet some other pop-up
                    > >> blockers that my users have installed does block it)
                    > >>
                    > >> (No exceptions have been made in IE's Pop-up blocker settings either)
                    > >>
                    > >> Private Function openNewWindow(B yVal url As String, ByVal windowName
                    > >> As String, ByVal features As String) As String
                    > >>
                    > >> ' url parameter must be enclosed in single quotes!!!
                    > >>
                    > >> Dim sb As System.Text.Str ingBuilder = New
                    > >> System.Text.Str ingBuilder
                    > >> sb.Append("java script:var " & windowName & " = window.open(" +[/color][/color][/color]
                    url[color=blue][color=green][color=darkred]
                    > >> + ",'" + windowName + "','" & features + "');" & windowName &
                    > >> ".focus();" )
                    > >>
                    > >> Return sb.ToString()
                    > >> End Function
                    > >>
                    > >> The code is not really important here. I think I might be missing the
                    > >> big picture; are pop-up allowed if they are user initiated. (i.e. a[/color][/color][/color]
                    user[color=blue][color=green][color=darkred]
                    > >> click a hyperlink that causes the pop-up)?
                    > >>
                    > >> BTW, here is a great link I saw yesterday to encapsulate creating a
                    > >> pop-up into a class:
                    > >>
                    > >>[/color][/color][/color]
                    http://www.dotnet2themax.com/ShowCon...9-6f952f31491a[color=blue][color=green][color=darkred]
                    > >>
                    > >> Greg
                    > >>
                    > >> "Kevin Spencer" <kspencer@takem pis.com> wrote in message
                    > >> news:Oe65wZplEH A.324@TK2MSFTNG P11.phx.gbl...
                    > >>> Forgive me. I spoke too quickly Upon reflection, I realized that
                    > >>> JavaScript
                    > >>> can't click a hyperlink. Oh well. I can't think of any other way to[/color][/color][/color]
                    open[color=blue][color=green][color=darkred]
                    > >>> a
                    > >>> new browser window that won't be foiled by popup blockers. Best to try
                    > >>> another route.
                    > >>>
                    > >>> --
                    > >>> HTH,
                    > >>> Kevin Spencer
                    > >>> .Net Developer
                    > >>> Microsoft MVP
                    > >>> I get paid good money to
                    > >>> solve puzzles for a living
                    > >>>
                    > >>> "bruce barker" <nospam_brubar@ safeco.com> wrote in message
                    > >>> news:ed96JxolEH A.3544@TK2MSFTN GP15.phx.gbl...
                    > >>>> while you can emit javascript to do this, any popup blocker will stop
                    > >>>> it.
                    > >>>>
                    > >>>> -- bruce (sqlwork.com)
                    > >>>>
                    > >>>>
                    > >>>> "Rathtap" <amcniw@yahoo.c om> wrote in message
                    > >>>> news:b21a5958.0 409090743.56e95 c28@posting.goo gle.com...
                    > >>>> > I want to popup a window from my codebehind. The reason is that
                    > >>>> > during
                    > >>>> > the postback the code needs to do some validations and to build the
                    > >>>> > arguments that are passed in the url. How can I achieve this
                    > >>>> > functionality?
                    > >>>> > The reason I do not want to use Response.Redire ct is because when[/color][/color][/color]
                    the[color=blue][color=green][color=darkred]
                    > >>>> > user comes back to the first page, all the selections that were
                    > >>>> > made(which are the arguments) disappear.
                    > >>>>
                    > >>>>
                    > >>>
                    > >>>
                    > >>
                    > >>[/color]
                    > >
                    > >[/color]
                    >
                    >[/color]


                    Comment

                    Working...