Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to capture the date selected in a pop up

How to capture the date selected in a pop up

Scheduled Pinned Locked Moved ASP.NET
tutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rockyl
    wrote on last edited by
    #1

    Hi, I have a web page where clicking on a button I am opening another web form using window.open function. Now I want to know how to capture the date selected by the user and put it in the parent web form. Regards, Rocky

    Rakesh

    K S 2 Replies Last reply
    0
    • R rockyl

      Hi, I have a web page where clicking on a button I am opening another web form using window.open function. Now I want to know how to capture the date selected by the user and put it in the parent web form. Regards, Rocky

      Rakesh

      S Offline
      S Offline
      Sandeep Kumar
      wrote on last edited by
      #2

      hi.... You can do that using window.opener in javascript Example.... 1.html var anotherwindow=window.open("2.html") //change the background color of the second window from main anotherwindow.bgColor="black" 2.html Secondary window Regards, Sandeep Kumar.V

      1 Reply Last reply
      0
      • R rockyl

        Hi, I have a web page where clicking on a button I am opening another web form using window.open function. Now I want to know how to capture the date selected by the user and put it in the parent web form. Regards, Rocky

        Rakesh

        K Offline
        K Offline
        kubben
        wrote on last edited by
        #3

        The child form has a concept of the parent. You can access controls on the parent form via javascript. In javascript you would do something like this:

        self.opener.document.forms[0].parentControl.Value = childControl.value;

        Hope that helps. Ben

        R 1 Reply Last reply
        0
        • K kubben

          The child form has a concept of the parent. You can access controls on the parent form via javascript. In javascript you would do something like this:

          self.opener.document.forms[0].parentControl.Value = childControl.value;

          Hope that helps. Ben

          R Offline
          R Offline
          rockyl
          wrote on last edited by
          #4

          Thanks for the response. Where you want me to put this code in the child page. I mean in which event?

          Rakesh

          K 1 Reply Last reply
          0
          • R rockyl

            Thanks for the response. Where you want me to put this code in the child page. I mean in which event?

            Rakesh

            K Offline
            K Offline
            kubben
            wrote on last edited by
            #5

            Here is some vb.net code I wrote a while back. I had the user press a save button that did a post back and then called this method:

            Private Sub closewindow(ByVal indate As Date)
            Dim myScript As New StringBuilder
            With myScript
            .Append("")
            .Append(Environment.NewLine)
            'This code sets the correct field on the opener form
            Dim tmpstr As String = "self.opener.document.forms[0]." + CStr(Session("DatelookupField"))
            .Append(tmpstr)
            .Append(".value = """)
            .Append(indate.ToShortDateString)
            .Append("""")
            .Append(Environment.NewLine)
            'focus the opener form
            .Append("self.opener.focus()")
            .Append(Environment.NewLine)
            'Close the calendar window
            .Append("self.close()")
            .Append(Environment.NewLine)
            .Append("")
            Page.RegisterStartupScript("close window", .ToString())
            End With
            End Sub

            All this code is .net 1.1 I set a session variable in the parent form so I knew what the control name was to pass the date back to the parent form. Hope that helps. Ben

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups