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

Hide next month dates.

8 Answers 93 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Saira
Top achievements
Rank 1
Saira asked on 23 Jul 2013, 08:21 AM
Hi

I dont want the radcalendar to display dates from months other than the one selected on the header. Suppose I select july means, after july 31 the calendar display august dates. Please help
Saira

8 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 23 Jul 2013, 10:41 AM
Hi Saira,

Try setting the ShowOtherMonthsDays property of the RadCalendar to false in order to achieve your requirement.

Thanks,
Princy.
0
Saira
Top achievements
Rank 1
answered on 23 Jul 2013, 05:35 PM
Seems simple. I wasnt aware of such a property. I have another question, I am dynamically creating a radcalendar and as usual its displaying the current month view. So how can I display another month view with a certain date selected?
0
Princy
Top achievements
Rank 1
answered on 24 Jul 2013, 04:09 AM
Hi Saira,

Please have a look into the following C# code I tried which works fine at my end.

C#:
RadCalendar calendar1 = new RadCalendar();
//setting the selected date
calendar1.SelectedDate = System.DateTime.Parse("2013/08/24");
//changing the calendar view to the selected date
calendar1.FocusedDate = calendar1.SelectedDate;
//Adding the control to the current form.
this.form1.Controls.Add(calendar1);

Thanks,
Princy.
0
Saira
Top achievements
Rank 1
answered on 26 Jul 2013, 12:56 PM
Hello princy

Thanks a lot. I have another question. There are two radmonthyearpicker and after I want to calculate the difference between selected date. Please help.
0
Princy
Top achievements
Rank 1
answered on 26 Jul 2013, 01:03 PM
Hi Saira,

Please have a look into the following code I tried which works fine at my end.

ASPX:
<telerik:RadMonthYearPicker ID="RadMonthYearPicker1" runat="server">
</telerik:RadMonthYearPicker>
<telerik:RadMonthYearPicker ID="RadMonthYearPicker2" runat="server">
</telerik:RadMonthYearPicker>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />

C#:
protected void Button1_Click(object sender, EventArgs e)
{
    if (RadMonthYearPicker1.SelectedDate > RadMonthYearPicker2.SelectedDate)
    {
        int monthdifference=   ((RadMonthYearPicker1.SelectedDate.Value.Year - RadMonthYearPicker2.SelectedDate.Value.Year) * 12) + RadMonthYearPicker1.SelectedDate.Value.Month - RadMonthYearPicker2.SelectedDate.Value.Month;
    }
}

Thanks,
Princy.
0
Alok
Top achievements
Rank 1
answered on 24 Sep 2014, 07:18 AM
Hi,

I have set the ShowOtherMonthsDays = fasle which is correct but dynamically i am adding css for my selected date.
So in this case this is not working css still there.

See the code

DateTime dConfirmdate = Convert.ToDateTime(RDPSiteSurveyDate.SelectedDate);
        DateTime dProposaldate = Convert.ToDateTime(RDPInstallationProposed.SelectedDate);
        if (e.Day.Date.ToString("dd/MM/yyyy 00:00:00").Equals(dConfirmdate.ToString("dd/MM/yyyy 00:00:00")))
        {
                e.Cell.CssClass = "ConfirmedDates";
                e.Cell.ToolTip = "Confirmed Survey \n" + dConfirmdate.ToString("dd/MM/yyyy");
        }
        if (e.Day.Date.ToString("dd/MM/yyyy 00:00:00").Equals(dProposaldate.ToString("dd/MM/yyyy 00:00:00")))
        {
            e.Cell.CssClass = "ProposedDates";
            e.Cell.ToolTip = "Proposed Dates \n" + dProposaldate.ToString("dd/MM/yyyy");
        }
0
Angel Petrov
Telerik team
answered on 29 Sep 2014, 06:55 AM
Hi,

I am not sure about the exact scenario but you should be able to resolve the problem by applying the below provided CSS.
.rcOtherMonth {
            background:none !important;
        }

If the issue persists please share with us the entire page contents so we could further research the matter.

Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Alok
Top achievements
Rank 1
answered on 29 Sep 2014, 07:12 AM
No Problem!!

I solved my problem using -

 if (e.Cell.CssClass.Equals(""))
            {
                e.Cell.CssClass = "ConfirmedDates";
                e.Cell.ToolTip = "Confirmed Survey \n" + dConfirmdate.ToString("dd/MM/yyyy");
            }
Well i will try your solution, hope this will work.

Thanks...... 








Tags
Calendar
Asked by
Saira
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Saira
Top achievements
Rank 1
Alok
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or