A
AlexUhde
Hello!
I'm relative new to asp.net and I'm trying to figure out how i can
have a "auto fill" date in a textbox from a DetailsView in insertmode.
I know that with <%# Now %> in Text='' I can put the Date in the
TextBox Field.
And I know that i can use <%# Bind="date" %> to bind it to the date
part of the sql query.
But how can I make both with one textbox?
I tried all combinations but i got only errors.
My Code "Part" so far:
<asp:TemplateField HeaderText="Datum" SortExpression="date">
<EditItemTemplate>
<asp:TextBox ID="TextBox5" runat="server"
Text='<%# Bind("date") %>' Width="300px"></asp:TextBox>
<asp:Label ID="Label7" runat="server"
Text="tt.mm.jjjj hh:mm"></asp:Label>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator2" runat="server"
ControlToValidate="TextBox5"
ErrorMessage="Bitte Datum eingeben!"></
asp:RequiredFieldValidator>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox6" runat="server"
Text='<%# Bind("date") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label6" runat="server"
Text='<%# Bind("date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
I'm relative new to asp.net and I'm trying to figure out how i can
have a "auto fill" date in a textbox from a DetailsView in insertmode.
I know that with <%# Now %> in Text='' I can put the Date in the
TextBox Field.
And I know that i can use <%# Bind="date" %> to bind it to the date
part of the sql query.
But how can I make both with one textbox?
I tried all combinations but i got only errors.
My Code "Part" so far:
<asp:TemplateField HeaderText="Datum" SortExpression="date">
<EditItemTemplate>
<asp:TextBox ID="TextBox5" runat="server"
Text='<%# Bind("date") %>' Width="300px"></asp:TextBox>
<asp:Label ID="Label7" runat="server"
Text="tt.mm.jjjj hh:mm"></asp:Label>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator2" runat="server"
ControlToValidate="TextBox5"
ErrorMessage="Bitte Datum eingeben!"></
asp:RequiredFieldValidator>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox6" runat="server"
Text='<%# Bind("date") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label6" runat="server"
Text='<%# Bind("date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>