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

RadCalendar selected date

5 Answers 209 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Skypy
Top achievements
Rank 1
Skypy asked on 29 Jan 2008, 11:18 AM
Hello,

I try to get the selected date from Client-Side but it doesn't work :
var calendar = $find("<%= RadCalendar1.ClientID %>");
var dateselected = calendar.get_selectedDates();

How can I get the first selected date from the list ?

Thanks

5 Answers, 1 is accepted

Sort by
0
Skypy
Top achievements
Rank 1
answered on 29 Jan 2008, 02:39 PM
Well, I found myself :
var dd = new Date(dateselected[0][0], dateselected[0][1]-1, dateselected[0][2]);

But when I specify one client event, there is no more Server-Side event (disabled ?).
I need to use both, is it a bug ?

Thanks
0
Giuseppe
Telerik team
answered on 29 Jan 2008, 04:08 PM
Hi Skypy,

We are unable to reproduce the problematic behavior you are experiencing with the client/server events. Please review the attached application and let us know how it goes.


Kind regards,
Manuel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Skypy
Top achievements
Rank 1
answered on 29 Jan 2008, 05:04 PM
It worked with your sample, there is a problem with my big project but it seems to be complex.

When I set a client and a server event it broked ajax events with Calendar control.

Thanks for your sample.
0
Sebastian
Telerik team
answered on 30 Jan 2008, 09:02 AM
Hello Skypy,

Unfortunately we can not determine the exact cause for the issue you encountered without a working demo which demonstrates it. Hence I suggest you modify the example my colleague Manuel prepared to replicate the problem or isolate a stripped working version of your project and send it attached to a formal support ticket. We will examine it in detail and will get back to you with our findings.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Skypy
Top achievements
Rank 1
answered on 22 Feb 2008, 02:05 PM
Well, I found why and how : http://aspadvice.com/blogs/joteke/archive/2006/04/30/17118.aspx

Answer:

Well,  cross-page postbacks are implemented using javascript. And when you put return statement like that it ends up into onclick of the rendered button. For example Button like this

<asp:Button ID="Button2" runat="server" Text="Button" PostBackUrl="~/Default4.aspx" OnClientClick="return confirm('Hello');" />

 

renders

<input type="submit" name="Button2" value="Button" onclick="return confirm('Hello');WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;Button2&quot;, &quot;&quot;, false, &quot;&quot;, &quot;Default4.aspx&quot;, false, false))" id="Button2" />

 

As you can see, this effectively prevents rest of the postbacking script from functioning since whatever confirmation box returns, it won't let postback options to be set and therefore prevents cross-page postbacking from working.

Answer is to change confirm check so that it returns only when user click Cancel.

Put the OnClientClick as

OnClientClick ="if(!confirm('OK?'))return false;"

Then the rendered onclick attribute changes

onclick="if(!confirm('OK?'))return false;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;Button2&quot;, &quot;&quot;, false, &quot;&quot;, &quot;Default4.aspx&quot;, false, false))"


Tags
Calendar
Asked by
Skypy
Top achievements
Rank 1
Answers by
Skypy
Top achievements
Rank 1
Giuseppe
Telerik team
Sebastian
Telerik team
Share this question
or