RadCalendar and the manual postback

10 posts, 0 answers
  1. Mark
    Mark avatar
    17 posts
    Member since:
    Sep 2007

    Posted 25 Oct 2007 Link to this post

    I have code:
    <trk:RadCalendar ID="rdCalendar" runat="server" DayNameFormat="FirstLetter" EnableMultiSelect="false" AutoPostBack="false"
                <ClientEvents OnDateSelected="changeSchedulerView"/> 
                </trk:RadCalendar> 
    and
    function changeSchedulerView(calendarInstance, eventArgs) 
        __doPostBack('<%= rdCalendar.ClientID %>',eventArgs); 

    rdCalendar.SelectionChanged += new Telerik.Web.UI.Calendar.SelectedDatesEventHandler(rdCalendar_SelectionChanged); 

    I want to do "PostBack", when the date is selected. After "PostBack" I want to execute method: "rdCalendar_SelectionChanged". How can I do it??
  2. Chris Gillies
    Chris Gillies avatar
    384 posts
    Member since:
    May 2006

    Posted 25 Oct 2007 Link to this post

    Hi Mark,

    If you set the calendar property AutoPostBack to true, this behavior will be automatically executed - the control will postback on click of a date and the SelectionChanged server-side will be fired. You can review it here:

    http://www.telerik.com/DEMOS/ASPNET/Prometheus/Calendar/Examples/Programming/ServerSideEvents/DefaultCS.aspx

    Regards,
    Chris
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mark
    Mark avatar
    17 posts
    Member since:
    Sep 2007

    Posted 25 Oct 2007 Link to this post

    If I set the calendar property AutoPostBack to true, the page will be reloaded on every click (onClientcalendarviewchange, onClientdataselecting), but I want to reload the page only on dateclick.
  5. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 26 Oct 2007 Link to this post

    Hi Mark,

    Unfortunately such functionality is not supported -- RadCalendar works either in client mode (no postbacks) or in postback mode (date selection and month navigation trigger postback requests to the server).


    Regards,
    Manuel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Shaun Peet
    Shaun Peet avatar
    571 posts
    Member since:
    Aug 2004

    Posted 28 Oct 2007 Link to this post

    IMHO - it should offer this functionality though.
  7. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 29 Oct 2007 Link to this post

    Hello Shaun,

    Thank you for your feedback -- although we have no immediate plans of implementing such feature, we will forward it to our developers for further consideration.


    Best wishes,
    Manuel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  8. Kevin
    Kevin avatar
    1 posts
    Member since:
    Nov 2007

    Posted 18 Dec 2007 Link to this post

    Do you have any alternatives?  I only want the body of my page to refresh if a date is clicked, not if the user navigates between months.  Thank you.
  9. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 19 Dec 2007 Link to this post

    Hi Kevin,

    You can trigger the postback on date selection manually like this:

    <script type="text/javascript"
    function OnDateSelected(sender, args) 
        var calendar = <%= RadCalendar1.ClientID %>
        calendar.DoPostBack("d"); 
    </script> 
     
    <radcln:RadCalendar ID="RadCalendar1" runat="server"
        <ClientEvents OnDateSelected="OnDateSelected" /> 
    </radcln:RadCalendar> 


    Hope this helps.


    Kind regards,
    Manuel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  10. Drew
    Drew avatar
    22 posts
    Member since:
    Mar 2009

    Posted 27 May 2009 Link to this post

    this was a few years ago, have there been any changes made or does this still apply? i would only like to postback if a day is selected.

    Drew
  11. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 28 May 2009 Link to this post

    Hi Drew,

    The RadCalendar control support a number of client-side events and methods that let you respond to user actions without a postback. You can achieve the desired functionality by setting the AutoPostBack property from client side. Have a look at the following example.

    ASPX:
     
    <telerik:radcalendar id="RadCalendar1" runat="server" AutoPostBack="True" OnSelectionChanged="RadCalendar1_SelectionChanged" OnDefaultViewChanged="RadCalendar1_DefaultViewChanged">          
        <ClientEvents OnCalendarViewChanging="OnCalendarViewChanging" OnDateClick="OnDateClick" />          
    </telerik:radcalendar> 

    JavaScript:
     
    <script type="text/javascript">  
    function OnCalendarViewChanging(sender, eventArgs)  
    {  
        sender.set_autoPostBack(false);  
    }  
    function OnDateClick(sender, eventArgs)  
    {  
        sender.set_autoPostBack(true);  
    }  
    </script> 

    CS:
     
    protected void RadCalendar1_SelectionChanged(object sender, Telerik.Web.UI.Calendar.SelectedDatesEventArgs e)  
    {  
        // Your code  
        // Response.Write("Selection changed");  

    Regards,
    Princy.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017