DetailsView UpdateCommand

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>
[...]
 
A

Andre

Problem's solved... i changed VisibleDate='<%# Bind("begin_date") %>' by
VisibleDate='<%# Eval("begin_date","{0:d}") % >'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top