ClientSide setting of the SelectedDate

7 posts, 0 answers
  1. SolutionStream
    SolutionStream avatar
    40 posts
    Member since:
    Apr 2009

    Posted 13 May 2009 Link to this post

    Is it possible to set the scheduler's SelectedDate with a client side javascript call?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 May 2009 Link to this post

    Hello Keir,

    One suggestion would be to using RadAjaxManager and updating the RadScheduler from code behind. Here is the code which I tried.

    ASPX:
     
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadScheduler1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
     
    <telerik:radscheduler id="RadScheduler1" runat="server" Skin="Vista"
    </telerik:radscheduler> 
     
    <asp:Button ID="Button1" runat="server" Text="Select Date from client" OnClientClick="SelectDate(); return false;"/> 

    JavaScript:
     
    <script type="text/javascript"
    function SelectDate() 
        $find("<%=RadAjaxManager1.ClientID %>").ajaxRequest('Button1'); 
    </script> 

    CS:
     
    protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) 
        if (e.Argument == Button1.ClientID) 
        { 
            RadScheduler1.SelectedDate = DateTime.Today.AddDays(1); // Add one day and set as selected date 
        } 

    You can also refer the following forum link:
    Client side selected date modification



    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. SolutionStream
    SolutionStream avatar
    40 posts
    Member since:
    Apr 2009

    Posted 14 May 2009 Link to this post

    Shinu;

    Thanks for your response, unfortunately i'm not sure how or even if I can add a code behind file to our MVC.net project.  Is there no other way?
  5. SolutionStream
    SolutionStream avatar
    40 posts
    Member since:
    Apr 2009

    Posted 14 May 2009 Link to this post

    Ok, so i have figured out how to set the initial time display using Jquery, but am concerned that i'm not really putting my value into the correct input.

    $(function() { 
                 $("#ctl00_MainContent_RadTimePicker_StartTime_dateInput_text").val('<%= Model.StartTime.ToShortTimeString() %>'); 
                 $("#ctl00_MainContent_RadTimePicker_EndTime_dateInput_text").val('<%= Model.EndTime.ToShortTimeString() %>'); 
             }) 


    Is there a more appropriate input field?
  6. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 16 May 2009 Link to this post

    Hello Kier,

    Please, be advised that RadScheduler does not support ASP.NET MVC at the time being. For more information, review this help topic:
    http://www.telerik.com/help/aspnet-ajax/mvc-limitations.html


    Kind regards,
    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. DoomerDGR8
    DoomerDGR8 avatar
    133 posts
    Member since:
    Aug 2010

    Posted 28 Oct 2010 Link to this post

    How can ^this exact functionality be achieved when working in a content page and with a RadAjaxManagerProxy?

    I have these two script functions in my markup file:

    function RowClick(sender, eventArgs) {
        var grid = sender;              
        var MasterTable = grid.get_masterTableView();
        var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
        var cell = MasterTable.getCellByColumnUniqueName(row, "ColumnJobDate");
        //here cell.innerHTML holds the value of the cell
        //alert(cell.innerHTML);
        SelectDate(cell.innerHTML);
    }

    And

    function SelectDate(_DateValue) {
        $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("-||DATE||-" + _DateValue);
    }

    And the grid's related markup:

    <ClientSettings AllowRowsDragDrop="True">
        <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />
        <ClientEvents OnRowDropping="rowDropping" OnRowClick="RowClick" />
    </ClientSettings>

    The code-Behind:

    protected void manager_AjaxRequest(object sender, AjaxRequestEventArgs e) {
        //handle the manager AjaxRequest event here
        if (e.Argument.Contains("-||DATE||-")) {
            string extractedDate = e.Argument.Remove(0, 10);
            DateTime realDate = DateTime.Parse(extractedDate);
            RadSchedulerArmy.SelectedDate = new DateTime(realDate.Year, realDate.Month, realDate.Day);
        }
    }
     
    protected void Page_Load(object sender, EventArgs e) {
        RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
        manager.ClientEvents.OnRequestStart = "onRequestStart";
        manager.ClientEvents.OnResponseEnd = "onResponseEnd";
        manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(manager_AjaxRequest);
     
        if (Page.IsPostBack == false) {
            //TODO Implement a better user login...
            //code code code
        }
    }
              
    Result is, I get a console error I get through Firebug:

    onRequestStart is not defined
    [Break on this error] }else{this[a]=eval(b);

    Anybody with clues, any pointers will be highly regarded.
  8. DoomerDGR8
    DoomerDGR8 avatar
    133 posts
    Member since:
    Aug 2010

    Posted 28 Oct 2010 Link to this post

    Ok. Solved by implementing the two script functions onRequestStart & onResponseEnd and it started to work. Now, the issue of the continuos Ajax request is disturbing the user input. I want to be able to stop further processing if the JobDate from the grid's row and the current SelectedDate of the Scheduler is same.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017