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

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
 
T

Teemu Keiski

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.
 
S

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.

Good point, thanks!

/Seb
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top