Note that there are some explanatory texts on larger screens.

plurals
  1. POClient populating server collections at runtime
    primarykey
    data
    text
    <p>I am adding to a List of DateTime objects on the server every time a date is selected on a Calender control by the client, and in turn highlighting all the selected dates on the control. I'm able to highlight (change back-color) of dates instantiated in the List on page load, and the first selected date by the client. However further date selections on the control are just changing which date is highlighted, ie. not highlighting more. </p> <p>I had thought by adding the selected DateTime object to a list at runtime upon a selection and then adding each of them to the Calendars "selected dates" property will get around the problem of the calendar control clearing the SelectedDates property on selection of a new date. Debugging by printing all the dates within the dates List to a textbox show that the dates the list was instantiated with and the latest selection are only in the list, not previous selections. My question and what I think is the problem, Can a List on the server be populated by actions from the client at runtime, and added to? I am using ASP with C# .Net3.5 on VS2008. Thanks</p> <p>My Code System.Collections.Generic.List dates;</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { this.dates = new List&lt;DateTime&gt;(); this.dates.Add(new DateTime(2009,12,2)); this.dates.Add(new DateTime(2009, 12, 3)); this.dates.Add(new DateTime(2009, 12, 16)); fillDates(); } protected void AvailCalender_SelectionChanged(object sender, EventArgs e){ this.dates.Add(this.AvailCalender.SelectedDate); foreach (DateTime date in this.dates) { this.AvailCalender.SelectedDates.Add(date); this.displayText.Text = this.displayText.Text + date.ToShortDateString(); } fillDates(); } protected void fillDates() { foreach (DateTime dates in this.dates) { this.AvailCalender.SelectedDates.Add(dates); } this.AvailCalender.SelectedDayStyle.BackColor = System.Drawing.Color.Blue; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload