c# - Month calendar highlights the dates that i dont wont? -
i have created following set of month calendar controls
the top set of calendar controls identify th start , end of course feb 2014 month month after feb
i have code follows in load() event of form
datetime dtsem1 = new datetime(mcsem1start.selectionrange.start.year, 2, 1); datetime dtsem2 = new datetime(mcsem2start.selectionrange.start.year, 6, 1); mcsem1start.selectionstart = dtsem1; mcsem1end.selectionstart = dtsem1.addmonths(1); mcsem2start.selectionstart = dtsem2; mcsem2end.selectionstart = dtsem2.addmonths(1); mcsem1start_datechanged(mcsem1start, new daterangeeventargs(dtsem1, dtsem1)); mcsem2start_datechanged(mcsem2start, new daterangeeventargs(dtsem2, dtsem2));
if can see have set date of first month calendar of top row 1st of feb , seond 1 1st of march. there highlighting beteen dates range did not code highlight them, why hightlights date range , how fix it?
thanks
when set selectionstart
, no selectionend
, it's automatically selecting range of days equal value of maxselectioncount
.
setting value 1 before setting start dates fixes issue:
mcsem1start.maxselectioncount = 1; mcsem1end.maxselectioncount = 1; mcsem2start.maxselectioncount = 1; mcsem2end.maxselectioncount = 1;
alternatively, set end date of same day:
mcsem1start.selectionstart = dtsem1; mcsem1start.selectionend = dtsem1; mcsem1end.selectionstart = dtsem1.addmonths(1); mcsem1end.selectionend = dtsem1.addmonths(1);
or select "range" single day:
mcsem1start.selectionrange = new selectionrange(dtsem1, dtsem1); var nextmonth = dtsem1.addmonths(1); mcsem1end.selectionrange = new selectionrange(nextmonth, nextmonth);
Comments
Post a Comment