How do I add a Date Suffix to the ColumnHeaderDateFormat in a RadScheduler Timeline view?

7 posts, 0 answers
  1. Karl
    Karl avatar
    172 posts
    Member since:
    Sep 2010

    Posted 12 Mar 2013 Link to this post

    I know how to format the column headers in a RadScheduler's TimeLineView so I can display the date in any format I choose, but cannot see how I would add the date suffix.

    For example I want to show the short version of the days name, followed by the date of the month.
    For today (Tuesday, 12th of March 2013) I want to display "Tue 12th" but all I can get is "Tue 12".

    Personally, it makes no odds to me and I prefer just the "Tue 12" for a number of reasons, but the powers that be want the date suffix!

    Anyone have any ideas?
    Thanks,
    Karl
  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 15 Mar 2013 Link to this post

    Hello Karl,

    Since such date time formatting does not comes out of the box, I have prepared a custom client-side functionality that implements very similar scenario only for your RadScheduler Timeline View.
    //markup code
    <telerik:RadScheduler runat="server" ID="RadScheduler1" >
     </telerik:RadScheduler>
    //JavaScript
    function pageLoad() {
        $ = $telerik.$;
        var scheduler = $find('<%=RadScheduler1.ClientID %>');
        if (scheduler.get_selectedView() == Telerik.Web.UI.SchedulerViewType.TimelineView) {
            var headerColumns = $(".rsHorizontalHeaderTable th div");
            headerColumns.each(function (index, elem) {
                var date = $.trim($(elem).text());
                var indexOfSpace = date.indexOf(" ");
                var monthDay = date.substring(indexOfSpace + 1, date.lenght);
                if (monthDay == 1) {
                    date += "st";
                }
                else if (monthDay == 2) {
                    date += "nd";
                }
                else {
                    date += "th";
                }
                $(elem).text(date);
            });
        }
         
    }



    Regards,
    Boyan Dimitrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. shubhangi
    shubhangi avatar
    19 posts
    Member since:
    Aug 2015

    Posted 14 Sep 2015 Link to this post

    Where we can call this Function Page_load()

    Thanks,

    Shubh

  5. shubhangi
    shubhangi avatar
    19 posts
    Member since:
    Aug 2015

    Posted 14 Sep 2015 in reply to shubhangi Link to this post

    Hi,

    I have added function below for showing jobstatus in different color as per requirement. for that i have added some html code and showing as i want. 

      function page_load() {
                var $ = $telerik.$;
                var $header = $(".rsHeader h2");
                var result = '';
                result += '<Span class ="tab">' + "<u>Job Status:</u> " + '<Span class ="clr1"> ' + "Success" + '</span>' + '<Span class ="clr2">' + " Runing " + '</span>' + '<Span class ="clr3">' + " Failed " + '<span>' + '<Span class ="clr4">' + " Deleted " + '</span>' + '</span>';
                $header.html($header.html() + result)
            }

    Code Behind:

       protected void Page_Load(object sender, EventArgs e)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "page_load()", true);

            }

     But after inserting record the label are not visible means page is not loading again. Please give me any idea where we can call this function Page_Load(). You can see implemented changes in attachment image.

     

    Thanks,

    shubh

  6. Plamen
    Admin
    Plamen avatar
    2730 posts

    Posted 17 Sep 2015 Link to this post

    Hello,

    You can sue the  pageLoad() without the need to register it from the code behind.

    Regards,
    Plamen
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  7. shubhangi
    shubhangi avatar
    19 posts
    Member since:
    Aug 2015

    Posted 24 Nov 2015 in reply to Plamen Link to this post

    Hi..

    I tried its not working after adding or updating schedule or after clicking on radscheduler calendar. Please help me in to this..

  8. Plamen
    Admin
    Plamen avatar
    2730 posts

    Posted 26 Nov 2015 Link to this post

    Hi,

    I am attaching the code that worked correctly at my side.

    Regards,
    Plamen
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017