Solved

Need help using dtPicker in an ASP page.

Posted on 2001-08-14
8
304 Views
Last Modified: 2007-12-19
I have an ASP page (using VBScript) and need to use the dtPicker to allow data entry of a date. Including the following <object> on a form displays the control correctly but I do not know how to reference the date in the ASP page.

<object ID="Microsoft Date and Time Picker Control 6.0 (SP4)" classid="CLSID:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1" width=120 height=25>
</object>

0
Comment
Question by:BryanC
  • 4
  • 3
8 Comments
 
LVL 5

Expert Comment

by:mattyk
ID: 6386006
Place the object inside of the form you are going to be using.  I would then remove the ID attribute all together and add a name attribute set to something simple.  Like this:

<form action="junk.asp">
<object name="datePicker" classid="CLSID:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1"
width=120 height=25>
</object>
<input type=submit>
</form>

than in the asp that is going to be processing things you can simply use

request.querystring("datePicker")


Here's a sample working page.  Save this page as junk.asp and run it:

<body>
<form action="junk.asp">

<object name="datePicker" classid="CLSID:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1"
width=120 height=25>
</object>

<input type=submit>
</form>

<hr>
<%
for each key in request.querystring
     response.write key & " = " & request.querystring(key) & "<br>"
next
%>
</body>

cheers,
matty
0
 
LVL 7

Expert Comment

by:John844
ID: 6386010
start by changing the id to something usable in script like
<object ID="test" classid="CLSID:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1"
width=120 height=25>
</object>


you can then trap for changes in the control like

<SCRIPT LANGUAGE=javascript FOR=test EVENT=Change>
<!--
     alert(test.Year)
//-->
</SCRIPT>

if you want to get to the values in asp after the user picks a value then you will need a form to submit the information back to the server.  Add a hidden field and call it txtTest for now.  Here is the code to update the hidden field to the date entered.

<SCRIPT LANGUAGE=javascript FOR=test EVENT=Change>
<!--
     document.forms(0).item("txtTest").value = test.Month + "/" + test.Day + "/" + test.Year
//-->
</SCRIPT>
0
 

Author Comment

by:BryanC
ID: 6388358
Thanks Matty and John. You did help me solve my original problem but now I have a problem initializing the value of the control. In the following code the FORMAT is set correctly but the VALUE is not. Does anyone know what I am doing wrong?

<%
strURL       = Request.ServerVariables("URL")
ReportDate   = Request.Form("DatePicker")
%>
<form action="<%= strURL %>" method="post">
     Select Starting Date:
     <object name="datePicker" classid="CLSID:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1" width=150 height=25>
     <PARAM name="FORMAT" value="1" >
     <PARAM name="VALUE" value=<%=ReportDate%> >
     </object>
     <br>
     <input type="submit" Name="GenReportBtn" Value="Generate Report" />
</form>
<%
response.write("ReportDate   = " & ReportDate & "<br>")
%>


0
 
LVL 7

Accepted Solution

by:
John844 earned 50 total points
ID: 6388402
try this, change
<PARAM name="VALUE" value=<%=ReportDate%> >
to
<PARAM NAME="CurrentDate" VALUE="<%=cdbl(cdate(ReportDate))%>">

the current date parameter is expecting the numeric representation of the date.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 7

Expert Comment

by:John844
ID: 6388405
you might try just adding "s around the value like
<PARAM name="VALUE" value="<%=ReportDate%>" >

I haven't tried this to verify it.
0
 

Author Comment

by:BryanC
ID: 6388508
Thanks John. I appreciate your help.
0
 
LVL 7

Expert Comment

by:John844
ID: 6388577
No problem, I enjoy it.  If this question is complete, you should accept one of the answers provided so that points are awarded and this question will be moved into the Previously Asked Question collection.

John
0
 

Author Comment

by:BryanC
ID: 6388891
This was my first time to use the devX system and I am very pleased. I thank you again for the help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Translate a cURL request to Classic ASP 4 418
Smart quotes being changed on insert 9 50
Using querystring in a hyperlink 3 46
Using Classic ASP inside HTML pages 2 56
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now