PC Review


Reply
Thread Tools Rate Thread

DetailsView Textbox with Bind and Date?

 
 
AlexUhde
Guest
Posts: n/a
 
      5th Feb 2007
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>&nbsp;
</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>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DetailsView TextBox Barry Microsoft Dot NET Framework 1 26th Jul 2008 10:19 AM
how bind TextBox to date type? mtczx232@yahoo.com Microsoft Dot NET Framework Forms 0 10th Oct 2007 06:37 PM
DetailsView & TextBox (C#) G Microsoft C# .NET 1 28th Aug 2007 05:19 PM
Bind a date null to textbox SilviaLl Microsoft VB .NET 1 23rd Mar 2007 02:30 AM
Howto bind a date to a textbox from a strongly typed dataset AMDRIT Microsoft ADO .NET 5 4th Aug 2005 10:13 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:38 AM.