Custom server control... whats wrong and am I on the right track?

  • Thread starter Thread starter Seb
  • Start date Start date
S

Seb

I'm trying to code a calendar control which allows multiply selection
of dates and can read from a datasource. The second part is working.
However I'm having some trouble with the multiply selection part.

The code for my control can be found at http://rafb.net/p/GSVLyd81.html

Should I use the Session object to store my data? Or is viewstate the
right tool for the task?

On line 46 in the method OnSelectionChanged. The condition
SelectedDates.Contains(d) always evaluates to true... I'm really
confused here. and this causes the entire control not to work! any
ideas about what I'm doing wrong?

I'm also looking for best practice feedback as well as answers to the
questions above. There are a few questions in the comments as well.

best regards,
Seb
 
Hi,

you definately shouldn't rely on Session if you can't be sure it is used on
pages where session is enabled - vesides what if the control is used twice
on the same page, is that possible? Viewstate is better way, but of course
by trying to minimize what you'd need to put to viewstate.
 
Hi,

you definately shouldn't rely on Session if you can't be sure it is used on
pages where session is enabled - vesides what if the control is used twice
on the same page, is that possible? Viewstate is better way, but of course
by trying to minimize what you'd need to put to viewstate.

Good point, thanks!

/Seb
 
Back
Top