From 996fe86b901e031f748d803eab5bbd3b05fff20a Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Thu, 8 Jul 2021 14:49:02 +0200 Subject: [PATCH] Bugfix: don't overwrite with new init --- Site/Controls/v5/Base/DateTextBox.ascx.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Site/Controls/v5/Base/DateTextBox.ascx.cs b/Site/Controls/v5/Base/DateTextBox.ascx.cs index cfbb9859..aa83f426 100644 --- a/Site/Controls/v5/Base/DateTextBox.ascx.cs +++ b/Site/Controls/v5/Base/DateTextBox.ascx.cs @@ -17,12 +17,17 @@ namespace Swarmops.Frontend.Controls.Base protected void Page_Load (object sender, EventArgs e) { this.TextInput.Attributes["role"] = "note"; // disable Lastpass trying to autofill - this.InterpretedDate.Value = DateTime.Today.ToString(CultureInfo.InvariantCulture); // initialize to valid value if (this.Layout == LayoutDirection.Unknown) { this.Layout = LayoutDirection.Vertical; } + + if (!Page.IsPostBack) + { + this.InterpretedDate.Value = DateTime.Today.ToString(CultureInfo.InvariantCulture); + // initialize to valid value + } } public DateTime Value