Using now() in a <asp:textbox>
Posted
by Anthony
on Stack Overflow
See other posts from Stack Overflow
or by Anthony
Published on 2010-04-22T20:06:49Z
Indexed on
2010/04/22
20:13 UTC
Read the original article
Hit count: 256
Can anyone help. I am using a formview in VS 2005. I have different elements in my form databound to a database and I am performing an INSERT SQL statement. No problem. The problem is that I am trying to enter the current date into the SQL statement and I am having a problem.
I can add <%now()%> to the "Text" property of the asp:Textbox. But when I do, then I can't bind the textbox to a specific database column.
How do I do both????
I can do this:
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Initiate_Date") %>' ></asp:TextBox>
Or this:
<asp:TextBox ID="TextBox2" runat="server" Text='<%# now() %>' ></asp:TextBox>
But I don't know how to do both.
© Stack Overflow or respective owner