RadCalendar Ajax

6 posts, 0 answers
  1. John Giblin
    John Giblin avatar
    155 posts
    Member since:
    Jan 2006

    Posted 07 Jul 2010 Link to this post

    I have a RadCalendar that it use to update the content in a Iframe when the date selected has changed.  It seems when I use the arrows to change the month or year, it appears to make a new request as opposed to an Ajax Request.  I see in a tool it contains the entire page content.  When I put break points in my code I do see the request going to the page load.  any ideas why it is doing this?




        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
            onajaxrequest="RadAjaxManager1_AjaxRequest">
            <AjaxSettings>
                <telerik:AjaxSetting  AjaxControlID="rcStartDate">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rcStartDate"></telerik:AjaxUpdatedControl>
                        <telerik:AjaxUpdatedControl ControlID="lbTitle" />
                        <telerik:AjaxUpdatedControl ControlID="lbFilename" />
                        <telerik:AjaxUpdatedControl ControlID="lbStartDate" />
                        <telerik:AjaxUpdatedControl ControlID="iframe"  />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

                 <telerik:RadCalendar ID="rcStartDate"  runat="server" Font-Names="Arial, Verdana, Tahoma"
                        ForeColor="Black" FirstDayOfWeek="Monday"  AutoPostBack=true  
                        Skin="Web20" ondayrender="rcStartDate_DayRender"  
                        onselectionchanged="rcStartDate_SelectionChanged" MultiViewRows=2
                        EnableMultiSelect="False">
                                <SelectedDayStyle CssClass="SelectedDatesCSS" />
                                <ClientEvents OnDayRender="OnDayRender" />
                        </telerik:RadCalendar>



                 <telerik:RadCalendar ID="rcStartDate"  runat="server" Font-Names="Arial, Verdana, Tahoma"
                        ForeColor="Black" FirstDayOfWeek="Monday"  AutoPostBack=true  
                        Skin="Web20" ondayrender="rcStartDate_DayRender"  
                        onselectionchanged="rcStartDate_SelectionChanged" MultiViewRows=2
                        EnableMultiSelect="False">
                                <SelectedDayStyle CssClass="SelectedDatesCSS" />
                                <ClientEvents OnDayRender="OnDayRender" />
                        </telerik:RadCalendar>
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 12 Jul 2010 Link to this post

    Hello John,

    Note that the Ajax enabled application still goes to the PageLoad event and this is expected. The core idea behind AJAX is to make the communication with the server asynchronous, so that data is transferred and processed in the background. So the data is silently update, however the PageLifeCycle is not changed. In the request from the server you should see only information for the controls added in the updated controls collection.

    Regards,
    Maria Ilieva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. John Giblin
    John Giblin avatar
    155 posts
    Member since:
    Jan 2006

    Posted 15 Jul 2010 Link to this post


    Thanks for the explanation.  I wasnt sure if the PageLoad was suppose to get execute

    The problem that I am having is that when I change the date on the calandar it reloads the iframe in the page. The only time I change the Iframe is when SelectionChanged is triggered.  Is their a way for the iframe not to be re-loaded. Nothing in the parent page is triggering it. Below is the Selection change

     

     

    protected void rcStartDate_SelectionChanged(object sender, Telerik.Web.UI.Calendar.SelectedDatesEventArgs e)

     

    {

     

     

    // LoadSpecialDays();

     

     

     

    PostedReportsBusinessLayer objposted = new PostedReportsBusinessLayer();

     

     

     

    DataTable dt = objposted.GetLatestReport(catId, rcStartDate.SelectedDate);

     

     

     

    if (dt.Rows[0]["Title"] .ToString().Length>0)

     

    {

    lbTitle.Text = dt.Rows[0][

     

    "Title"].ToString();

     

    lbStartDate.Text = ((

     

    DateTime)dt.Rows[0]["StartDate"]).ToShortDateString();

     

    lbEndDate.Text = ((

     

    DateTime)dt.Rows[0]["EndDate"]).ToShortDateString();

     

    lbFilename.Text = dt.Rows[0][

     

    "FileName"].ToString();

     

    rcStartDate.SelectedDate = (

     

    DateTime)dt.Rows[0]["StartDate"];

     

     

    iframe.Attributes[

     

    "src"] = "StreamIframeFile.aspx?file=" + dt.Rows[0]["FILENAME"].ToString() + "&FilePath=" + contentRoot + dt.Rows[0]["Id"].ToString();

     

     

     

    //injectScript.Text = "<script type='text/javascript'>\n window.frames['" + iframe.ClientID + "'].src=\"StreamIframeFile.aspx?file=" + dt.Rows[0]["FILENAME"].ToString() + "&FilePath=" + contentRoot + dt.Rows[0]["Id"].ToString() + "\"\n</" + "script>";

     

     

    }

    }



  4. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 20 Jul 2010 Link to this post

    Hi John Giblin,

    When the date in the calednar control is changed the SelectionChanged event will fire as expected. If you need not to update the iframe on any other option

    All the best,
    Maria Ilieva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. John Giblin
    John Giblin avatar
    155 posts
    Member since:
    Jan 2006

    Posted 21 Jul 2010 Link to this post

    Sorry. I meant to say when you changed the focused month. When I change the month it doesnt not trigger the selectedChange like expected.  But it doesnt refresh the Iframe.
  6. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 23 Jul 2010 Link to this post

    Hi John Giblin,

    In order to have the iframe properly updated you the Calendar control should initiate postback. If you need to update it when the calendar view is changed autopostback property should be set to "true"


    All the best,
    Maria Ilieva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top