Selecting a date with the Calendar control clears the FileUpload control

  • Thread starter Thread starter Nathan Sokalski
  • Start date Start date
N

Nathan Sokalski

I have an ASP.NET 2.0 webform which includes both a FileUpload contol and a
Calendar control. When the user selects a new data with the Calendar
control, the FileUpload control is reset (there is no longer a file selected
if one was previously selected). I am assuming this is because the Calendar
control causes a postback when a date is selected. Does anyone know of a way
to prevent this from happening? Thanks.
 
I have an ASP.NET 2.0 webform which includes both a FileUpload contol and
a Calendar control. When the user selects a new data with the Calendar
control, the FileUpload control is reset (there is no longer a file
selected if one was previously selected). I am assuming this is because
the Calendar control causes a postback when a date is selected.

Yes - that and the fact that the FileUpload control doesn't persist its
value in ViewState, nor can it be populated manually, for security
reasons...
Does anyone know of a way to prevent this from happening?

1) Don't use the <asp:Calendar> control - use a client-side JavaScript date
picker instead.

2) Use AJAX
 
Back
Top