If I understand you correctly, I'm not sure how to do it programatically however you could leverage the CSS to "hide" the "other" month. I've edited my CSS file so much that I no longer know what the default is however, open the .css file and find the .calothermonth
and set the visibility to hidden. If you add a TD to it this will hide all contents in the table cell.
/* OTHER MONTH */
TD.calothermonth {
visibility:
hidden;
}
Timmy a 'User Experience' (UX) Consultant
www.SevenUX.com
Use the following to only show the current month cells in the calendar. I tried using the visible property but that screws up the alignment in the calendar.
tharakatk
0 Points
2 Posts
How to display Only the current month in the Event calander
Jan 24, 2008 03:31 AM|LINK
I need to know how to display only the current month days by avoiding other months days. Is it possible to do it in the event calander????
harminder si...
Participant
1021 Points
571 Posts
Re: How to display Only the current month in the Event calander
Jan 24, 2008 05:40 AM|LINK
if you want to show current date when you open calender then set
cal.value=current date
tharakatk
0 Points
2 Posts
Re: How to display Only the current month in the Event calander
Jan 24, 2008 06:39 AM|LINK
No.. my requirement is to display days belongs to a perticular month by avoiding others months days
Eg; for january, in calander i dont want to display December last week at the begining and the February first week at the end...
SevenUX
Member
22 Points
18 Posts
Re: How to display Only the current month in the Event calander
Jan 31, 2008 05:57 AM|LINK
If I understand you correctly, I'm not sure how to do it programatically however you could leverage the CSS to "hide" the "other" month. I've edited my CSS file so much that I no longer know what the default is however, open the .css file and find the .calothermonth and set the visibility to hidden. If you add a TD to it this will hide all contents in the table cell.
/* OTHER MONTH */
TD.calothermonth { visibility: hidden;}
www.SevenUX.com
SevenUX
Member
22 Points
18 Posts
Re: How to display Only the current month in the Event calander
Jan 31, 2008 05:58 AM|LINK
OK, um... where do you add the cal.value=current date???? Can you please elaborate?
www.SevenUX.com
amirmuthu
Member
36 Points
56 Posts
Re: How to display Only the current month in the Event calander
May 08, 2008 09:27 AM|LINK
Use the following code
<asp:Calendar id="Calendar1" runat="server" Font-Size="10pt" BorderColor="White" BackColor="White"
Width="216px" ForeColor="Black" Font-Names="Verdana" Height="188px" BorderWidth="1px" NextPrevFormat="ShortMonth">
<SelectedDayStyle ForeColor="White" BackColor="#CCCCCC"></SelectedDayStyle>
<OtherMonthDayStyle ForeColor="White"></OtherMonthDayStyle>
<NextPrevStyle Font-Size="8pt" Font-Bold="True" ForeColor="#333333" VerticalAlign="Bottom"></NextPrevStyle>
<DayHeaderStyle Font-Size="8pt" Font-Bold="True"></DayHeaderStyle>
<TitleStyle Font-Size="10pt" Font-Bold="True" BorderWidth="4px" ForeColor="#333399" BorderColor="Black"
BackColor="White"></TitleStyle>
</asp:Calendar>
MuthuKrishnan Gurusamy
PsychoDUCK
Member
6 Points
3 Posts
Re: How to display Only the current month in the Event calander
Sep 14, 2010 05:14 PM|LINK
Use the following to only show the current month cells in the calendar. I tried using the visible property but that screws up the alignment in the calendar.
Code Behind:
protected void CalendarDRender(object sender ,System.Web.UI.WebControls.DayRenderEventArgs e ) { if(e.Day.IsOtherMonth) { //e.Cell.Visible = false; e.Cell.Text = ""; } }Front End: