Last post May 13, 2019 11:14 AM by mgebhard
May 13, 2019 10:31 AM|qsoft_developer|LINK
How can I change the date inside a TextBox with TextMode="Date" that uses a TextBoxWatermarkExtender?
I can't seem to do it from code behind:
<asp:TextBox ID="mailToDate" TextMode="Date" runat="server" Width="250px"></asp:TextBox>
<ajaxToolkit:TextBoxWatermarkExtender ID="mailToDate_WM" runat="server"
mailToDate.Enabled = true;
mailToDate_WM.Enabled = true;
mailToDate.Text = DateTime.Now.ToShortDateString();
May 13, 2019 11:14 AM|mgebhard|LINK
You are using two competing concepts. The TextBox is configured to render as the HTML 5 Date input.
The browser controls the UI and expects a data formatted as yyyy-MM-dd not a short date string. Change your code to set the input value to the expected format.