DetailsView UpdateCommand

Discussion in 'ASP .Net' started by Andre, Jan 24, 2006.

  1. Andre

    Andre Guest

    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>
    [...]
    Andre, Jan 24, 2006
    #1
    1. Advertising

  2. Andre

    Andre Guest

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


    "Andre" <> a écrit dans le message de news:
    ...
    > 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>
    > [...]
    >
    Andre, Jan 25, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark

    UpdateCommand with Datalist

    Mark, Jul 17, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,400
  2. rote

    UpdateCommand DetailsView

    rote, Nov 23, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    370
    BlueJumper.com
    Nov 23, 2007
  3. srathin

    DataGrid1 UpdateCommand calling DataGrid2 UpdateCommand

    srathin, Apr 9, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    157
    srathin
    Apr 9, 2005
  4. srathin

    DataGrid1 UpdateCommand calling DataGrid2 UpdateCommand

    srathin, Apr 9, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    149
    srathin
    Apr 11, 2005
  5. Feege
    Replies:
    0
    Views:
    417
    Feege
    Dec 20, 2005
Loading...

Share This Page