Custom displays

2 posts, 0 answers
  1. JedF
    JedF avatar
    16 posts
    Member since:
    Aug 2009

    Posted 12 Jan 2011 Link to this post

    Hello

    I am needing to display along the top of the scheduler just the sundays for the month.
    Down the side i am need to display data from my database table (eg. House1,House2,House3,House4)

    In each cell i need to display 3 dropdownlists which will be saved to the database. Has anyone got some code to help me with this.

    Thanks in advance
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 14 Jan 2011 Link to this post

    Hi JeF,

    Please, try the following code:

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
           <script type="text/javascript">
               var specialDaysIndexes = new Array();
               function pageLoad() {
                   if ($find('<%=RadScheduler1.ClientID %>').get_selectedView() == Telerik.Web.UI.SchedulerViewType.TimelineView) {
                       var $ = $telerik.$;
                       $('.rsDisabled').each(function (i) {
                           specialDaysIndexes.push($(this).index());
                       });
                       for (x in specialDaysIndexes) {
                           $($(".rsHorizontalHeaderTable th", $find('<%=RadScheduler1.ClientID %>').get_element()).get(specialDaysIndexes[x])).css("width", "0px")
                           $($(".rsHorizontalHeaderTable th", $find('<%=RadScheduler1.ClientID %>').get_element()).get(specialDaysIndexes[x])).css("border", "none");
                       }
                       specialDaysIndexes = [];
                   }
               }  
           </script>
       </telerik:RadCodeBlock>
       <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
           <AjaxSettings>
               <telerik:AjaxSetting AjaxControlID="RadScheduler1">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RadScheduler1" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
           </AjaxSettings>
       </telerik:RadAjaxManager>
       <telerik:RadScheduler runat="server" ID="RadScheduler1" SelectedView="TimelineView"
           OnTimeSlotCreated="RadScheduler1_TimeSlotCreated" OnNavigationComplete="RadScheduler1_NavigationComplete">
           <TimelineView UserSelectable="false" ColumnHeaderDateFormat="ddd d MMM" HeaderDateFormat="M" GroupBy="User" GroupingDirection="Vertical" />
           <DayView UserSelectable="false" />
           <WeekView UserSelectable="false" />
           <MonthView UserSelectable="false" />
       </telerik:RadScheduler>

    protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack & RadScheduler1.SelectedView == SchedulerViewType.TimelineView)
            {
                int year = RadScheduler1.SelectedDate.Year;
                int month = RadScheduler1.SelectedDate.Month;
                int numberOfDaysInCurrentMonth = DateTime.DaysInMonth(year, month);
                RadScheduler1.SelectedDate = new DateTime(year, month, 1);
                RadScheduler1.TimelineView.NumberOfSlots = numberOfDaysInCurrentMonth;
            
      
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            RadScheduler1.Provider = new XmlSchedulerProvider(Server.MapPath("~/App_Data/Appointments.xml"), true);
        }
        protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
        {
            if ((e.TimeSlot.Start.DayOfWeek != DayOfWeek.Sunday) && (RadScheduler1.SelectedView == SchedulerViewType.TimelineView))
                e.TimeSlot.CssClass = "rsDisabled";
        }
        protected void RadScheduler1_NavigationComplete(object sender, SchedulerNavigationCompleteEventArgs e)
        {
            if (RadScheduler1.SelectedView == SchedulerViewType.TimelineView)
            {
                int year = RadScheduler1.SelectedDate.Year;
                //We need to add 3 days to make up for the largest possible difference 
                //in the number of days for any two months(31-28=3). 
                int month = RadScheduler1.SelectedDate.AddDays(3).Month;
                int numberOfDaysInCurrentMonth = DateTime.DaysInMonth(year, month);
                RadScheduler1.SelectedDate = new DateTime(year, month, 1);
                RadScheduler1.TimelineView.NumberOfSlots = numberOfDaysInCurrentMonth;
            }
        }




    Best wishes,
    Peter
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top