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

RadCalendar Ajax

5 Answers 85 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
John Giblin
Top achievements
Rank 1
John Giblin asked on 07 Jul 2010, 05:23 PM
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>

5 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 12 Jul 2010, 01:48 PM
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
0
John Giblin
Top achievements
Rank 1
answered on 15 Jul 2010, 04:22 PM

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

 

 

}

}



0
Maria Ilieva
Telerik team
answered on 20 Jul 2010, 01:35 PM
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
0
John Giblin
Top achievements
Rank 1
answered on 21 Jul 2010, 02:50 PM
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.
0
Maria Ilieva
Telerik team
answered on 23 Jul 2010, 09:38 AM
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
Tags
Calendar
Asked by
John Giblin
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
John Giblin
Top achievements
Rank 1
Share this question
or