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

Hide "No End Date" option in Recurrence Editor

5 Answers 239 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 17 Mar 2011, 02:51 PM

 

In the Telerik Recurrence Editor control I want to hide "No End Date" while leaving "End After" and "End By".  I can't allow my clients the ability to make recurring reservations with no end date.

I was able to hide the option button by finding the id of the control but there is no id for the label of that option button.  So, I can hide the radio button but not the label for it.

Can anyone provide some code for this?

One work around would be to validate that the No End Date option is not selected after post back but I'd rather not do that.

Thanks,
Rob

 

 



 



5 Answers, 1 is accepted

Sort by
0
Robert
Top achievements
Rank 1
answered on 17 Mar 2011, 04:12 PM

If anyone is able to hide these controls via client side I'd still like to know how.

--

Since I wasn't able to hide the control (for now), I created the following validation controls as a work around.

Client Side >>

 

 

 

<asp:CustomValidator ID="validateRecurrenceUntil" runat="server" Display="Dynamic"
    ForeColor="red" ErrorMessage="* Recurrence until date must be greater than conference end date. <br/>"
    OnServerValidate="ValidateRecurrenceUntil" />
<asp:CustomValidator ID="validateRecurrenceNoEndDate" runat="server" Display="Dynamic"
        ForeColor="red" ErrorMessage="* Recurrence cannot be indefinite. <br/>"
        OnServerValidate="ValidateRecurrenceNoEndDate" />


Server Side >>

With my configuration I implemented my own check box for Recurrence and hide the built in one.

protected void ValidateRecurrenceUntil(Object source, ServerValidateEventArgs args)
{
    args.IsValid = true;
    try
    {
        if (this.chkRecurrence.Checked)
        {
            if (this.RecurrenceEditor1.RecurrenceRule.Range.RecursUntil < this.CalculateEnd())
            {
                args.IsValid = false;
                upWizard.Update();
            }
        }
    }
    catch (System.Exception ex)
    {
        args.IsValid = true;
        upWizard.Update();
    }
}
protected void ValidateRecurrenceNoEndDate(Object source, ServerValidateEventArgs args)
{
    args.IsValid = true;
    DateTime dteNoEndDate = Convert.ToDateTime("12/31/9999");
    try
    {
        if (this.chkRecurrence.Checked)
        {
            if (this.RecurrenceEditor1.RecurrenceRule.Range.RecursUntil >= dteNoEndDate)
            {
                args.IsValid = false;
                upWizard.Update();
            }
        }
    }
    catch (System.Exception ex)
    {
        args.IsValid = true;
        upWizard.Update();
    }
}


0
Accepted
Veronica
Telerik team
answered on 17 Mar 2011, 05:54 PM
Hi Robert,

You can easily remove the "No End Date" label and radiobutton by suscribing to the OnClientFormCreated event and using the following jQuery code in the handler:

<script type="text/javascript">
       function OnClientFormCreated(sender, eventArgs) {
           $telerik.$(".rsAdvOptionsPanel ul li:first-child").hide();
       }
   </script>


All the best,
Veronica Milcheva
the Telerik team
0
Robert
Top achievements
Rank 1
answered on 17 Mar 2011, 06:51 PM

Thanks for your quick reply, yes that works great, just what I wanted. 
0
Robert
Top achievements
Rank 1
answered on 18 Mar 2011, 09:25 PM

Hi Veronica,

Unfortunately, your solution is also hidding the Daily: Every [1] day(s) option as well.  This is an option I want to display.

The yearly and monthly options are also missing their first elements. 

0
Accepted
Peter
Telerik team
answered on 19 Mar 2011, 11:00 AM
Hi Robert,

Here is a more specific selector:
<script type="text/javascript">
      function OnClientFormCreated(sender, eventArgs) {
          $telerik.$(".rsAdvRecurrenceRangePanel .rsAdvOptionsPanel ul li:first-child").hide();
      
  </script>


Kind regards,
Peter
the Telerik team
Tags
Scheduler
Asked by
Robert
Top achievements
Rank 1
Answers by
Robert
Top achievements
Rank 1
Veronica
Telerik team
Peter
Telerik team
Share this question
or