Forum Moderators: open

Message Too Old, No Replies

Dynamically filling asp:textbox with date

using <%DateTime%> within asp:textbox

         

Argblat

4:30 pm on Jun 16, 2005 (gmt 0)

10+ Year Member



Can someone please enlighten me as to how to include the asp code <%=DateTime.Now.ToShortDateString()%> within an asp:textbox as the value in order that the text box be automatically filled in with the date from the server.

Reader's Digest:
How do I put this:
<%=DateTime.Now.ToShortDateString()%>

Into this:
<asp:textbox id="careerDate" TextMode="SingleLine" Columns="32" runat="server" Text='' />

mattglet

5:30 pm on Jun 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In your PageLoad event, put this:

careerDate.Text = DateTime.Now.ToShortDateString()

Argblat

6:06 pm on Jun 16, 2005 (gmt 0)

10+ Year Member



Thank you kindly, works like a charm.

-Mike