Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am trying to include the Calendar 1

Status
Not open for further replies.

leighsw

Programmer
Dec 6, 2000
4
GB
I am trying to include the Calendar ActiveX control on a web page. I want to then display a subsequent page based on the date selected by the user.

I can display it using the <OBJECT> tag, but I want to create the control using ASP via the Server.CreateObject method and then display the control on the page.

This is how I am trying to do it: -

<%
Option Explicit
Dim objCal, caldate
Set objCal=Server.CreateObject(&quot;MSCAL.Calendar&quot;)
%>
<SCRIPT LANGUAGE=vbscript>
Option Explicit
Sub objCal_AfterUpdate( )
<%caldate=objCal.Value%>
viewer.document.location.href = &quot;displaypage.asp?name=<%=caldate%>&quot;
End Sub
</SCRIPT>

<object classid=&quot;clsid:8E27C92B-1264-101C-8A2F-040224009C02&quot; id=<%=objCal%> width=&quot;288&quot; height=&quot;192&quot;>
<param name=&quot;_Version&quot; value=&quot;524288&quot;>
I have left out the rest of the <param name tags for clarity
</object>


In the next page I am using
gotdate = request.querystring(&quot;name&quot;)
to get hold of the date but surprise, surprise it is always empty. I have a feeling that I am not far off, but need a little inspiration.

Should I be using html to display the calendar as I have used the Server.CreateObject? Or should I be displaying it some other way? Is that ridiculous?

As you have probably realised I am a beginner!! So sorry if the solution is painfully obvious to you! I have looked all over the web and referred to many books but can't quite crack this one.

Thanks for the help in advance.
 
I was under the impression that Server.CreateObject(...) was meant to be used server side and not for displaying objects on a page. When I have done this previously, I have always included the cab files on the site and let the user download the component and included the object on the page with <object> tags.

Simon
 
leighsw,

Your mixture of client side and server side script seems a bit over complicated. However I am not sure I understand exactly what your idea is.

Try just getting the date from the client control in your afterupdate handler

<SCRIPT LANGUAGE=vbscript>
Option Explicit
Sub objCal_AfterUpdate( )
viewer.document.location.href = &quot;displaypage.asp?name=&quot; + document.xCal.Value;
End Sub
</SCRIPT>

<object classid=&quot;clsid:8E27C92B-1264-101C-8A2F-040224009C02&quot; id=&quot;xCal&quot; width=&quot;288&quot; height=&quot;192&quot;>

I don't see why you need a server side instance of the calendar based on my interpretation of your code.

-pete

 
Okay, thanks for trying to help me ... looking back, I don't think I worded my query very well. How do I use the Microsoft ActiveX Calendar control to pass a date - chosen by the user - to another page? Hope you can help, thanks again.
 
Just for completeness here's how I managed to solve the problem, thanks to swilliams &amp; palbano for their input. (My code was a bit overcomplicated!)

<SCRIPT LANGUAGE=vbscript>
Option Explicit
Dim name
Sub Calendar1_AfterUpdate( )
viewer.document.location.href = &quot;displaypage.asp?name=&quot; &amp; Calendar1.Value
End Sub
</SCRIPT>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top