ASP - Passing data to Parent Page from Calendar Page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manjeetgrang
    New Member
    • Feb 2008
    • 36

    ASP - Passing data to Parent Page from Calendar Page

    Hi

    i m working with HTML with ASP, Javascript and i am facing a problem with monthly calender date selection. I am able to dispaly calender in seprate window /explorer. But i am not able to pass that date value to main HTML Page input box that is selected by client. What i should do to pass that value back to kind of ASP file to Kind of HTML file. Or there is another way to do this

    MSG
  • idsanjeev
    New Member
    • Oct 2007
    • 241

    #2
    Originally posted by manjeetgrang
    Hi

    What i should do to pass that value

    MSG
    Hi manjeetgrang
    you are using date calender from java and you have value in form 12:00 so,
    use to pass date value
    Code:
    <%session.LCID=3081%>
    thanks

    Comment

    • DrBunchman
      Recognized Expert Contributor
      • Jan 2008
      • 979

      #3
      Originally posted by idsanjeev
      Hi manjeetgrang
      you are using date calender from java and you have value in form 12:00 so,
      use to pass date value
      Code:
      <%session.LCID=3081%>
      thanks
      idsanjeev,

      How will this help to pass the date value back to his original page? Unless I am missing something, using Session.LCID merely sets the Locale of your session to a particular location - in this instance Australian English. This can be useful for changing the format of dates, currencies etc that are displayed on your page.

      Am I incorrect or have you perhaps misunderstood the original question?

      Dr B

      Comment

      • DrBunchman
        Recognized Expert Contributor
        • Jan 2008
        • 979

        #4
        Originally posted by manjeetgrang
        Hi

        i m working with HTML with ASP, Javascript and i am facing a problem with monthly calender date selection. I am able to dispaly calender in seprate window /explorer. But i am not able to pass that date value to main HTML Page input box that is selected by client. What i should do to pass that value back to kind of ASP file to Kind of HTML file. Or there is another way to do this

        MSG
        Hi manjeetgrang,

        Are you using javascript to open your calendar page? If so you can use the following bit of script to pass the selected value of your calendar back to the parent page:
        Code:
          
        <script language="javascript">
        window.opener.document.getElementById('TextBox1').value = '<%=CalendarValue%>';window.close();
        </script>
        Simply run the above when your user has selected the date and you are ready to close the calendar pop-up.

        Hope this helps,

        Dr B

        Comment

        • idsanjeev
          New Member
          • Oct 2007
          • 241

          #5
          Originally posted by DrBunchman
          idsanjeev,

          How will this help to pass the date value back to his original page? Unless I am missing something, using Session.LCID merely sets the Locale of your session to a particular location - in this instance Australian English. This can be useful for changing the format of dates, currencies etc that are displayed on your page.

          Am I incorrect or have you perhaps misunderstood the original question?

          Dr B

          Hello DrBunchman
          Right
          when date selected in parent page and transfer to child then use of the code session LCID to convert date formate thats i am using when date was selected from javascripts and display on child

          Comment

          • DrBunchman
            Recognized Expert Contributor
            • Jan 2008
            • 979

            #6
            Originally posted by idsanjeev
            Hello DrBunchman
            Right
            when date selected in parent page and transfer to child then use of the code session LCID to convert date formate thats i am using when date was selected from javascripts and display on child
            If I understand you correctly then I do not believe that this answers the question that was being asked by the original poster.

            However it is a useful piece of code to be aware of and can save a lot of time being able to change all date formats on a page with a single line. A full list of the Locale ID values can be found here.

            Dr B

            Comment

            • manjeetgrang
              New Member
              • Feb 2008
              • 36

              #7
              Hi Dr

              i tried your code but still no result . Let me tell what i m doing as

              I am doing like in my HTML Page

              Code:
               
              <TD align=right><a href ="run.asp" target =" _blank "> Pickup date </a> <TD>
              <TD align='left"' width="25%"><INPUT name=Pickupdate></TD>
              Where hyperlink opens new window with calender in it
              Pickupdate is to assigned the value from calendar which is in run.asp file.

              and in my run.asp file i have code to design the calendar. There is function in run.asp file that assigns the current value to a inputbox to display selected date by user when user clicks on the date with
              .
              Code:
              document.forms[1].dateField.value = dateStr;
              Now i want to assign that date value which is in datestr in run.asp to pickupdate in HTML
              Last edited by DrBunchman; Jun 2 '08, 01:40 PM. Reason: Added code tags - Please use the # button

              Comment

              • DrBunchman
                Recognized Expert Contributor
                • Jan 2008
                • 979

                #8
                Try using the following snippet to open your new window then use the code I gave you earlier to return a value.
                Code:
                <a href="javascript:calendar_window=window.open('run.asp','calendar_window','width=280,height=240');calendar_window.focus()">Test</a>
                You don't need to specify the width and height parameters if you don't want to but for a calendar control it is useful to do so.

                Let me know if you can get this to work.

                Dr B

                Comment

                • manjeetgrang
                  New Member
                  • Feb 2008
                  • 36

                  #9
                  Hi Dr B

                  I am doing as you old me to do

                  Code:
                   
                  <TD align=right><a href="javascript:calendar_window=window.open ('run.asp','calendar_window','width=280,height=240');calendar_ window.focus ()">Test</a> 
                  </td> 
                  <script language="javascript">
                  window.opener.document.getElementById('Pickupdate'). value = '<%=CalendarValue%>';window.close();
                  </script>
                  <TD align='left"' width="25%"><INPUT name=Pickupdate></TD>
                  but when i click on test nothing happens no window pops up from hyperlink


                  msg

                  Comment

                  • DrBunchman
                    Recognized Expert Contributor
                    • Jan 2008
                    • 979

                    #10
                    Maybe I haven't explained how to implement this very well.

                    On your first page:
                    Code:
                     
                    <form name="TestForm">
                     <input type="text" name="TextBox1" />
                     <a href="javascript:calendar_window=window.open('Page2.asp','calendar_window','width=280,height=240');calendar_window.focus()">Test</a>
                    </form>
                    On your second page which I've called Page2.asp:
                    Code:
                     
                    <html>
                    <head>
                    <script language="javascript">
                    function ReturnVal()
                    	 {
                    	 window.opener.document.getElementById('TextBox1').value = document.form2.TextBox2.value;window.close();
                    	 }
                    </script>
                    </head>
                    <body>
                    	 <form name="form2">
                    		   <input type="text" name="TextBox2" onchange="ReturnVal();" />
                    	 </form>
                    </body>
                    <html>
                    I've just tested this and it worked. Upon clicking the link the new window opened. After typing in the textbox then tabbing out from it the new window closed and returned the typed text to TextBox1. Can you try this out please and let me know if it works.

                    If it does then the next step is to change it for your own use. You'll need to edit the function ReturnVal() to return the date selected rather than the value of your textbox. You'll need to change the names of the pages and textboxes as appropriate as well.

                    Let me know how you get on,

                    Dr B

                    Comment

                    • manjeetgrang
                      New Member
                      • Feb 2008
                      • 36

                      #11
                      Hi Dr B

                      This 1 is working and i hope i will fix my problem now
                      MSG

                      Comment

                      • manjeetgrang
                        New Member
                        • Feb 2008
                        • 36

                        #12
                        Originally posted by manjeetgrang
                        Hi Dr B

                        This 1 is working and i hope i will fix my problem now
                        MSG

                        & Thanks Dr. B manjeet s grang

                        Comment

                        • DrBunchman
                          Recognized Expert Contributor
                          • Jan 2008
                          • 979

                          #13
                          No problem at all MSG, glad you got it working!

                          Dr B

                          Comment

                          Working...