M
miketayloruk
I'm using a detailsview control that I want to use to insert data to a
table. One of the fields is a date field and I want that to default to
todays date. In classic asp I would do it like this:
<input name="textfield" type="text" value="<%=now()%>" />
How do I do this in ASP.NET, heere is my current code:
<asp
etailsView ID="DetailsView1" runat="server"
AllowPaging="True" AutoGenerateRows="False" DataKeyNames="data_key"
DataSourceID="SqlDataSource1" Height="50px" Width="125px">
<Fields>
<asp:TemplateField HeaderText="data_key"
InsertVisible="False" SortExpression="data_key">
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"
Text='<%# Bind("data_date") %>'></asp:TextBox>
</InsertItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="data_comment"
HeaderText="data_comment" SortExpression="data_comment" />
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" ShowInsertButton="True" />
</Fields>
</asp
etailsView>
Thanks
table. One of the fields is a date field and I want that to default to
todays date. In classic asp I would do it like this:
<input name="textfield" type="text" value="<%=now()%>" />
How do I do this in ASP.NET, heere is my current code:
<asp
AllowPaging="True" AutoGenerateRows="False" DataKeyNames="data_key"
DataSourceID="SqlDataSource1" Height="50px" Width="125px">
<Fields>
<asp:TemplateField HeaderText="data_key"
InsertVisible="False" SortExpression="data_key">
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"
Text='<%# Bind("data_date") %>'></asp:TextBox>
</InsertItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="data_comment"
HeaderText="data_comment" SortExpression="data_comment" />
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" ShowInsertButton="True" />
</Fields>
</asp
Thanks