1
Answer

floating calender

kavita

kavita

18y
2k
1
hello, this is kavita
we all use calender to select date . I m also using but the position of calender is static at runtime .how it can be moved at runtime ?
also a calender show few last day of previous month and few first day of next month to fill calender . how it can be removed?

Answers (1)
0
Mohammed Ismail

Mohammed Ismail

NA 3 0 18y
Hi Kavita:

For your second question removing of previous and next month days:  you can not remove them but you can hide them by setting those days back and forecolors using OtherMonthDayStyle attribute of Calendar.

Eg: <OtherMonthDayStyle ForeColor="Blue" BorderStyle="None" BorderColor="Blue" BackColor="Blue"></OtherMonthDayStyle>


But those cells are selectable in order to suppress this, add this in DayRender event of calendar:

if (e.Day.IsOtherMonth==true)
   {
    e.Cell.BackColor = System.Drawing.Color.Blue;
    e.Cell.ForeColor = System.Drawing.Color.Blue;
    e.Day.IsSelectable = false;
  }


in Page_Load event add this:

Calendar1.Attributes["onMouseDown"] = "JavaScript:Void(0);";

try out this.