Dynamically creating time slot context menu

2 posts, 0 answers
  1. Chip Meyer
    Chip Meyer avatar
    5 posts
    Member since:
    Oct 2005

    Posted 03 Feb 2010 Link to this post

    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
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 09 Feb 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top