473,320 Members | 1,947 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

HELP - Passing Date from PopUp ASPX via JavaScript

Ok, here's the situation... I have a user control that contains two
textboxes (one for a from date/time and one for a to date/time) and two
image buttons. The user control itself is supposed to be used on a number
of different ASPX pages (that's why I made it a ASCX). When clicking the
image button, I run simple JavaScript to open another popup ASPX page that
contains a calendar control and two dropdownboxes for the time (hours :
minutes). Once the user selects their date and time on the popup ASPX page,
they then click a linkbutton ("Ok") to close the popup and pass the selected
date and time back to the textbox on the user control, which is part of the
main ASPX page. Make sense? I'm trying to use
window.opener.document.form.textbox.value= to send the value back. I also
tried window.opener.document.form.usercontrol.textbox.va lue=, and that
didn't work either.

The problem I'm having is that I cannot get the value back from the popup
ASPX form to the textbox on the user control. It seems as if the JavaScript
window.opener method doesn't know how to find the user control on the main
ASPX page.

Does anyone know how to solve such an issue?
Or, does anyone have any better solutions to my design?

Thanks.


Nov 19 '05 #1
1 2196
On Wed, 27 Jul 2005 10:28:21 -0500, billy <bi***@nospam.com> wrote:
Ok, here's the situation... I have a user control that contains two
textboxes (one for a from date/time and one for a to date/time) and two
image buttons. The user control itself is supposed to be used on a
number
of different ASPX pages (that's why I made it a ASCX). When clicking the
image button, I run simple JavaScript to open another popup ASPX page
that
contains a calendar control and two dropdownboxes for the time (hours :
minutes). Once the user selects their date and time on the popup ASPX
page,
they then click a linkbutton ("Ok") to close the popup and pass the
selected
date and time back to the textbox on the user control, which is part of
the
main ASPX page. Make sense? I'm trying to use
window.opener.document.form.textbox.value= to send the value back. I
also
tried window.opener.document.form.usercontrol.textbox.va lue=, and that
didn't work either.

The problem I'm having is that I cannot get the value back from the popup
ASPX form to the textbox on the user control. It seems as if the
JavaScript
window.opener method doesn't know how to find the user control on the
main
ASPX page.

Does anyone know how to solve such an issue?
Or, does anyone have any better solutions to my design?

Thanks.


I assume you've seen examples on the web like the following:

http://www.dotnetjohn.com/articles.aspx?articleid=67

The thing to be careful of is that you should always make dynamic any JS
that uses element IDs directly. Meaning this: when you put a textbox
inside a usercontrol, its id in the resulting html ends up being basically
its id with the usercontrol's id appended to it at the front. View the
source of your HTML and you'll see what I mean.

So basically you need to dynamically create the JS that happens in the <a
onclick to use the textbox's .ClientID instead (this property will give
you the ID in the resulting HTML), not the ID you named it in the .ascx.

Make sense? Many examples on the web don't point this out...that the ID
in the resulting HTML may be different if your textbox is inside a naming
container (like user control)....which is why using .ClientID all the time
is safest, and dynamically generating your script....

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Raju V.K | last post by:
can I use javascript and PHP in the following manner to create a pop-up window: <--- in <head> </head> <script language=javascript> function popup(folder1, file1) {...
2
by: luna | last post by:
ive read a few tutorials but im still not getting anywhere (most code ive seen is code inline - im using codebehind VB and aspx) im creating a link button that opens a popup calendar that once a...
4
by: Chris | last post by:
Hi, I am trying to create a popup calender so a user can click on a button on the main form, a calender will then popup, the user will select a date and then click ok on the popup. The date will...
5
by: Chris | last post by:
Hi, I have been trying for days, yes days, to use the calender from the asp.net timetracker starter kit. I am now frustrated. I finally get the popup calender to popup but when I click ok to...
8
by: Bishoy George | last post by:
how to let javascript code understand txtUser.Text? in window.open("WebForm26.aspx?User=txtUser.Text",.....................)
1
by: Seok Bee | last post by:
Dear Experts, Currently I am creating a webform using sp.net 2.0. I would like to create a date picker in my webform. I managed to create a a button to call-up the calendar and using the...
3
by: Learner | last post by:
Hello, I have two buttons on one of my VehicleDetails.aspx page. Obiviously these two buttons takes the user to two different pages. Now my client is interested in having a linkbutton instead of...
2
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
4
by: moondaddy | last post by:
I have a htm page where I need to pass some data to an aspx page as a means of sending data to the database. I don't need to see the aspx page so I was going to put it in a hidden iframe. This...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.