Binding a textbox to current 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)
 
M

Mark Rae

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...?
 
A

arun

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"
 
M

Mark Rae

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...
 
R

Rad [Visual C# MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top