I have this bit on codebehind:
txtDBirth.Text = DateTime.Now.ToString("Mon dd yyyy")
We would like the date to appear in the format of Month Day Year as in Oct 07 2011
Then on the markup, I have this:
<asp:TextBox runat="server" ID="txtDBirth" CssClass="TextBox" />
When we run this code, we would the value of this:
txtDBirth.Text = DateTime.Now.ToString("Mon dd yyyy")
to appear inside
<asp:TextBox runat="server" ID="txtDBirth" CssClass="TextBox" />
perhaps like:
<asp:TextBox runat="server" ID="txtDBirth" CssClass="TextBox" value="Oct 07 2011/>
The idea is that the date value in the markup will change automatically to the current day’s date.
Is this possible?
You can do that by simply doing sort of what you are already doing except that the format for your date is wrong. It should be something like:
Will print:
You can’t make the markup change automatically and you shouldn’t need to, anyway. You are using a TextBox control and the
TextProperty is for setting the value inside the control.UPDATE (after reading comment to John Saunders):
You could do:
On code behind:
You set
txtBirth.Textfrom your data and then you compare: