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

Prevent day view?

5 Answers 74 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 2
Joel asked on 05 Dec 2011, 09:12 PM
In the month view, Is there a way to prevent the user from clicking on the day number to look at the individual day?  I am not using this as a traditional scheduler, but rather a monthly read only informational page.  I have everything disabled so far except clicking on the number in the top left corner of each day.

Thanks.

5 Answers, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 08 Dec 2011, 05:35 PM
Hi Joel,

Try the following JavaScript:
function pageLoad()
{
    $telerik.$(".rsDateHeader").click(function (e) { return false; });
}

It prevents the default action of all the 'a' links on the page.

Best wishes,
Ivana
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
0
Joel
Top achievements
Rank 2
answered on 08 Dec 2011, 06:11 PM
Thank you very much for your response Ivana.  It appears that may fire after the day is already loaded?  Do I need to set a var of some sort first?


<%@ Page Language="VB" AutoEventWireup="false" CodeFile="calendar.aspx.vb" Inherits="execreports_calendar" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
       <style type="text/css">
        .AppointmentAlign
        {
             text-align:center;
        }
    </style>
</head>
<body>
  <script type="text/javascript">
      function pageLoad() {
            $telerik.$(".rsDateHeader").click(function(e) { returnfalse; });
          alert('dfdfdf');
      }
  </script>



0
Ivan Zhekov
Telerik team
answered on 12 Dec 2011, 10:12 AM
Hi Joel,

My name is Ivan and I work as a front end here at Telerik. Ivana has asked me to assist her for your case.

I am not quite sure that I understood your question correctly.

On a related note "pageLoad" is a system function that gets triggered everytime the page is loaded. It's basically called whenever Applciation.Load is fired (another system function) which happens:
1) when the initial page is loaded
2) when you have partial postbacks and they are completed.

So if you put something in that pageLoad event, it will fire on all aforementioned events.

If that's not the answer to your question, can you clarify what you meant?

Best wishes,
Ivan Zhekov
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
0
Joel
Top achievements
Rank 2
answered on 12 Dec 2011, 03:37 PM
Thank you for your response Ivan.  I have attached the code for a simple page below to help clarify.

My intent is to restrict users to only the month view, and never be able to see week or day views.  I have successfully completed that requirement with the code below, with the exception of 1 case.

When a user clicks on the date in the month view (top left hand corner of each days square in month view), that takes the user to the day view.  The javascript pageload function fires, but it fires after the day view loads (it appears), which is what I would expect from javascript.  By adding an alert to the javascript in the first response (which I appreciate), I can see the day view behind the alert prior to it firing.

What I would like to do is disable the link on the day, or if that is not possible, ignore the postback if it comes from a "day", while still being able to accept postbacks from the arrows for the month navigator, or from the popup calendar.  Is there perhaps some way in CSS to deactivate the day link perhaps if that option is not accessible via the Scheduler control?

The reasoning for this is that I am not using it as a scheduler, which I know is the control's intent.  I have attached an image of what is currently being output from the control.  Each day has 2 appointments 12:01 am for the large font number and 5:00am for the small number.  It makes no sense for the users of course to see them as appointments with times.

<telerik:RadScheduler runat="server" ID="rsMonth" Height="700px" Width="800px"
           SelectedView="MonthView" Skin="Windows7" DataKeyField="calid" DataStartField="daydate" DataEndField="daydate" DataSubjectField="myval"  >
 </telerik:RadScheduler>
  
  
    Protected Sub rsMonth_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles rsMonth.Load
       rsMonth.Skin = ddlSkin.SelectedItem.Value
       rsMonth.DataSource =  _getDT()
       rsMonth.FirstDayOfWeek = DayOfWeek.Monday
       rsMonth.LastDayOfWeek = DayOfWeek.Sunday
       rsMonth.ReadOnly = True
       rsMonth.AppointmentStyleMode = AppointmentStyleMode.Simple
       rsMonth.ShowViewTabs = False
       rsMonth.WorkDayStartTime = System.TimeSpan.Zero
   End Sub
0
Ivana
Telerik team
answered on 13 Dec 2011, 03:40 PM
Hello Joel,

Thank you for getting back to us.

I have prepared a KB article for this scenario, which is available at the following link:

How to disable the day number link that points to the day represented by the currently selected cell, in MonthView. You could take a look at it and see if this fits your needs. 

For your convenience, I have also attached a working sample web page which contains the solution of this scenario explained in details in the aforementioned KB article. You could download it and give it a try locally.

I hope this would be helpful.

Please feel free to contact us again if you have further questions.

Kind regards,
Ivana
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
Tags
Scheduler
Asked by
Joel
Top achievements
Rank 2
Answers by
Ivana
Telerik team
Joel
Top achievements
Rank 2
Ivan Zhekov
Telerik team
Share this question
or