Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 13th, 2005, 11:23 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default ASP.NET Calendar Control Client Side Access

Hi All,
Im trying to get the value of the asp:calendar control from the client side.

I have added the onclick attribute and have prevented the post back.
The problem is that my client side javascript does not recognise the Calendar as a control, it is a table of hyperlinks on the client.

What I need to do is populate a textbox with the calenders selected date on the client side.

Any assistance would be greatly appreciated.

======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
__________________
======================================
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."
--Shakespeare
======================================
  #2 (permalink)  
Old June 14th, 2005, 11:29 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Where have you added the onclick attribute?

-Peter
  #3 (permalink)  
Old June 14th, 2005, 07:17 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

The calendar is within a datagrid.
So I have added the onclick attribute during the itemdatabound event for the grid using calendar.Attibutes.Add("OnClick","")
The event for the onclick uses the unique id's of the calender and textbox within the datagrid.
I am successfully setting the textbax value, but it is set to "undefined" as the client side page does not seem to see the calendar control.

======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
  #4 (permalink)  
Old June 14th, 2005, 08:06 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I guess I'm still not clear on what you are actually doing when you run that onclick handler. I can't even think of where that onclick handler will show up, probably in the table that is rendered with the calendar in it.

However you are doing it, I suspect the core problem is that the calendar control doesn't really have a client-side control that you can access (unlike a textbox or select element). The selected date of the control is housed in the viewstate of the control so you can't directly access it. If you wanted to put the date somewhere, you could put it into a hidden element, or put it in as an attribute of the calendar control (the rendered HTML table) and then access it there thru client script.

-Peter
  #5 (permalink)  
Old June 17th, 2005, 11:45 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Thanks Peter,
Yes the event is rendered to the table so I am only really trapping the tables on click event.
So I guess I will either allow the post back and handle things from the server side.
Alternatively I'll use a custom calendar control.
I have used one from excentric world before that does the job.
I was hoping I could get ms asp.net calendar control to have the same functionality as that.
Thanks for you assistance.
Rod


======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is client-side validation in ASP.NET 2.0 possible? jacob ASP.NET 2.0 Basics 6 April 10th, 2007 05:07 AM
client side Calendar yossis ASP.NET 2.0 Basics 1 February 16th, 2007 06:06 PM
Print file at client side in asp.net manish.sharma04 ASP.NET 2.0 Basics 0 April 4th, 2006 08:46 AM
CLIENT SIDE TIME CALCULATION IN ASP.NET gmk51080 Javascript How-To 1 December 1st, 2004 01:29 AM
client side time calculation in asp.net gmk51080 Javascript 0 November 30th, 2004 04:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.