RadCalendar selected date

6 posts, 0 answers
  1. Skypy
    Skypy avatar
    31 posts
    Member since:
    Nov 2007

    Posted 29 Jan 2008 Link to this post

    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
  2. Skypy
    Skypy avatar
    31 posts
    Member since:
    Nov 2007

    Posted 29 Jan 2008 Link to this post

    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
  3. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 29 Jan 2008 Link to this post

    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
  4. Skypy
    Skypy avatar
    31 posts
    Member since:
    Nov 2007

    Posted 29 Jan 2008 Link to this post

    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.
  5. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 30 Jan 2008 Link to this post

    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
  6. Skypy
    Skypy avatar
    31 posts
    Member since:
    Nov 2007

    Posted 22 Feb 2008 Link to this post

    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))"


Back to Top