I'm working on a asp.net web form that requires the user to select a date. The asp page has a MultiView inside an UpdatePanel.
My issue is that when I have a TextBox with textmode="Date", the textbox will always be null on submit and trigger the requiredfield validator. If I change the textmode to plain text and type the date, the form will submit correctly. Also, if I remove the update panel, textmode="Date" will correctly select the date
<asp:UpdatePanel ID="upDetails" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<asp:MultiView ID="mvFormSteps" runat="server" ActiveViewIndex="0">
<asp:View ID="vwCoreDetails" runat="server">
//other elements...
<asp:TextBox
ID="txtSingleDate"
runat="server"
CssClass="form-control
form-control-sm border-dark-subtle"
TextMode="Date"
format="yyyy-MM-dd"/>
<asp:RequiredFieldValidator
ID="txtSingleDate_RequiredFieldValidator"
runat="server"
ControlToValidate="txtSingleDate"
Display="Dynamic"
ErrorMessage="Select the date of your event"
InitialValue=" "
ValidationGroup="insertValidation"
SetFocusOnError="true"
CssClass="text-danger" />
// other elements
<asp:LinkButton
ID="btnStep1Next"
runat="server"
CssClass="btn btn-primary float-end"
OnClick="btnStep1Next_Click" Visible="true"
CausesValidation="true"
ValidationGroup="insertValidation">
Next
</asp:LinkButton>
Any insights or workarounds would be appreciated. Thanks!
Debug.WriteLine(txtSingleDate.Text). Maybe you want to isolate your sample in an empty project and see if it works or not. If it does then something else in your project prohibids your web form from running as expected.