DetailsView UpdateCommand

  • Thread starter Thread starter Andre
  • Start date Start date
A

Andre

Hi,

I need some help with an UpdateCommand syntax.

Everything is ok with the major part of my update (if i don't use my
calendar).
For the Date field i use a Calendar, and i can't find a way to update my
DB with the new date.

Did someone have any answer or a palce where i can get some information
on this ?

Heres's my code :

[...]
<asp:TemplateField HeaderText="Begin_Date">
<EditItemTemplate>
<asp:Calendar ID="Calendar1" runat="server" SelectedDate='<%#
Bind("begin_date") %>' VisibleDate='<%# Bind("begin_date") %' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("begin_date",
"{0:d}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
[...]
<asp:SqlDataSource id="sqlDetail" runat=server
ConnectionString="<%$ConnectionStrings:SysAnnoncesConnectionString %>"
SelectCommand="SELECT * FROM Adds WHERE NoAuto=@noAuto"
UpdateCommand="UPDATE Adds SET Name = @Name, begin_date =
@calendar1.selecteddate WHERE noAuto = @NoAuto">
</asp:SqlDataSource>
[...]
 
Problem's solved... i changed VisibleDate='<%# Bind("begin_date") %>' by
VisibleDate='<%# Eval("begin_date","{0:d}") % >'
 
Back
Top