This is a migrated thread and some comments may be shown as answers.

Setting calander to blank with multiple calanders

3 Answers 76 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Matthew Bishop
Top achievements
Rank 1
Matthew Bishop asked on 06 Feb 2009, 04:26 AM
Hi,
I have a page with multiple calanders on it sharing the 1 calander popup.
I am trying to set them all to blank or null using the clear command, but it doesnt seem to be working.

For example if I had 4 calanders with the id of xx1, xx2, xx3, xx4 if I try to do this:
var datePicker = $find("xx1");
datePicker.clear();
datePicker = $find("xx2");
datePicker.clear();
datePicker = $find("xx2");
datePicker.clear();
datePicker = $find("xx2");
datePicker.clear();
or

document.getElementById("xx1").clear();
document.getElementById("xx2").clear();
document.getElementById("xx3").clear();
document.getElementById("xx4").clear();

or

document.getElementById("xx1").value="";
document.getElementById("xx2").value="";
document.getElementById("xx3").value="";
document.getElementById("xx4").value="";

or

eval("xx1.clear()");
eval("xx2.clear()");
eval("xx3.clear()");
eval("xx4.clear()");

nothing works. I am out of ideas for dodgy work arounds, and ill be buggered if I can get the clear command to work...help!

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 09 Feb 2009, 07:13 PM
Hi Matthew,

The RadCalendar control provide a flexible client-side API. You can easily interact with the controls in the browser using their client-side objects.

The RadCalendar client object represents dates as triplets. Each triplet is an array of three integer values, which specify the year, month, and day of a date, in that order. 

To set the selected date on a RadCalendar control, use the selectDate() or selectDates() method:

function SelectToday()  
{  
 var todaysDate = new Date();  
 var todayTriplet = [todaysDate.getFullYear(), todaysDate.getMonth()+1, todaysDate.getDate()];  
 var calendar = $find("<%=RadCalendar1.ClientID%>");  
 calendar.selectDate(todayTriplet, true);  
}  

On RadCalendar, you can unselect individual dates using the unselectDate or unselectDates method:

function ClearCalendar()  
{  
 var calendar = $find("<%= RadCalendar1.ClientID %>");  
 calendar.unselectDates(calendar.get_selectedDates());  
}  

Find more information on the following links:
Client-Side Basics
RadCalendar Client Object
Client-Side Events

I hope this information helps.

Best regards,

Pavlina
the Telerik team

 


Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Matthew Bishop
Top achievements
Rank 1
answered on 10 Feb 2009, 07:02 AM
nope that is no good.

what you have given me there is how to access the radcalender only.

I am using multiple raddatepickers, which all share the radcalender.

I need to be able to clear the values for in the raddatepicker textbox, i dont need to clear what is selected in the shared calander.

An once again, I need it in javascript so i dont have to do a postback just to clear a textbox...
0
Matthew Bishop
Top achievements
Rank 1
answered on 10 Feb 2009, 07:05 AM
well for somr reason i just got it....

$find(

"T€"+fields[i]).clear();

where '"T€"+fields[i]' is the id of the textbox

not sure why that didnt work before....

 

Tags
Calendar
Asked by
Matthew Bishop
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Matthew Bishop
Top achievements
Rank 1
Share this question
or