Prevent day view?

6 posts, 0 answers
  1. Joel
    Joel avatar
    166 posts
    Member since:
    Oct 2006

    Posted 05 Dec 2011 Link to this post

    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.
  2. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 08 Dec 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Joel
    Joel avatar
    166 posts
    Member since:
    Oct 2006

    Posted 08 Dec 2011 Link to this post

    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>



  5. Ivan Zhekov
    Admin
    Ivan Zhekov avatar
    539 posts

    Posted 12 Dec 2011 Link to this post

    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
  6. Joel
    Joel avatar
    166 posts
    Member since:
    Oct 2006

    Posted 12 Dec 2011 Link to this post

    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
  7. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 13 Dec 2011 Link to this post

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