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

Dynamically creating time slot context menu

1 Answer 78 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Chip Meyer
Top achievements
Rank 1
Chip Meyer asked on 03 Feb 2010, 06:46 PM
Hi, what I am trying to do is create a time slot context menu based upon the selected value of a radcombobox. What I see happening is that the scheduler is bound once but never server-bound again unless I change the selected date or otherwise do some action on the scheduler.

I have tried to fire rebind() and select a date but the binding (whether inside _databound, _init) does not fire. 

functionschedule.rebind(); 
functionschedule.set_selectedDate("2/3/2010"); //rs.get_selectedDate()); 
alert('rebinded'); 

Am I going to need to build the context menu on the client? Does client "rebind()" require a web services datasource?

Thanks, Chip

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 09 Feb 2010, 08:21 AM
Hello,

I can confirm that rebind() will only work in Web Service mode for the moment. We'll update it to work for server-side binding as well in the future. The easiest way to force an update now is to use RadAjaxManager:

<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadScheduler1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
<script runat="server">
    protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
        if (e.Argument == "Refresh")
            RadScheduler1.Rebind();
    }
</script>
 
<%-- The wrapper server div is a workaround for
     'The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).' --%>
<div runat="server">
    <script type="text/javascript">
        function refreshScheduler()
        {
            var ajaxManager = $find('<%= RadAjaxManager1.ClientID %>');
            ajaxManager.ajaxRequest("Refresh");
        }
    </script>
</div>

Well, that's kind of verbose.

Building the menu on the client sounds like the better option in this case. You can do so in the OnClientTimeSlotContextMenu event as in this example (it demonstrates the similar OnClientAppointmentContextMenu event):

http://demos.telerik.com/aspnet-ajax/scheduler/examples/contextmenu/defaultcs.aspx

I hope this helps.

Greetings,
Tsvetomir Tsonev
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
Scheduler
Asked by
Chip Meyer
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or