Binding a textbox to current date

  • Thread starter Thread starter arun
  • Start date Start date
A

arun

Hi

How can I bind a textbox to current date in asp.net 2.0.

I want to achieve the same result that I will get when i am using
TextBox1.Text = System.DateTime.Now.ToString();
by binding in the aspx file(in the mark up for text box)
 
How can I bind a textbox to current date in asp.net 2.0.

I want to achieve the same result that I will get when i am using
TextBox1.Text = System.DateTime.Now.ToString();
by binding in the aspx file(in the mark up for text box)

Works for me - what error(s) are you getting...?
 
Thanks for replying.

I want to achieve the result by modifying the mark up like
<asp:TextBox ID="BookingDate" runat="server" Text='<% # Binding
Expression %>'></asp:TextBox>

I dont know how to achieve this and what should be the " Binding
Expression"
 
I want to achieve the result by modifying the mark up like
<asp:TextBox ID="BookingDate" runat="server" Text='<% # Binding
Expression %>'></asp:TextBox>

Is there any particular reason you want to do it this way...? Seems like
you're just making work for yourself...
 
Thanks for replying.

I want to achieve the result by modifying the mark up like
<asp:TextBox ID="BookingDate" runat="server" Text='<% # Binding
Expression %>'></asp:TextBox>

I dont know how to achieve this and what should be the " Binding
Expression"

Hey Arun,

Try DateTime.Now. It is a valid binding expression
 
Back
Top