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

Having ajax problems in courseware

1 Answer 54 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Dennis asked on 27 Jan 2009, 09:26 PM
Pretty sure I've followed every step but I've got two issues with the section on updating a label from a calendar click:

1) The ajax panel isn't working, I'm getting a full-page postback. I checked to make sure the calendar and label are contained inside the panel.

2) AjaxManager updates the label nicely, no postback, but when I click an arrow to change the month, the month doesn't change. I do get a quick refresh of the label...oddly, with a shorter delay than the 200ms when I click a day.

1 Answer, 1 is accepted

Sort by
Georgi Krustev
Telerik team
answered on 30 Jan 2009, 02:18 PM
Hello Dennis,

Straight onto your questions:

1) Please verify if with regular postback the label is updated properly. To ajaxify some controls, you need to wrap them only inside RadAjaxPanel. Thus the RadAjaxPanel will handle whole postbacks initiated from controls in it.

Here is a code snippet how I attained an asynchronous update of the label:
<html xmlns="">  
<head runat="server">  
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server">  
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">  
        <telerik:RadCalendar runat="server" Font-Names="Arial,Verdana,Tahoma" ForeColor="Black" 
            Style="border-color: #ececec" ID="RadCalendar1" AutoPostBack="true" ViewSelectorText="x" OnSelectionChanged="RadCalendar1_SelectionChanged">  
            <asp:Label ID="lblDate" runat="server" Text="No date"></asp:Label> 

Here is the handler of the SelectedIndexChanged event:
    protected void RadCalendar1_SelectionChanged(object sender, Telerik.Web.UI.Calendar.SelectedDatesEventArgs e)  
        if (e.SelectedDates.Count > 0)  
            lblDate.Text = e.SelectedDates[0].Date.ToShortDateString();  
Please note that the collection SelectedDates contains the list of all selected dates.

2) If you are using RadAjaxManager, avoid using of RadAjaxPanel.

Below is a code excerpt which implements the approach with RadAjaxManager:
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <telerik:AjaxSetting AjaxControlID="RadCalendar1">  
                    <telerik:AjaxUpdatedControl ControlID="RadCalendar1" /> 
                    <telerik:AjaxUpdatedControl ControlID="lblDate" /> 

For further information you can refer to these links:
Ajax manager, Ajax panel

Georgi Krustev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question