Update From DropDownList in DetailView

Discussion in 'ASP .Net Web Controls' started by Randy, May 5, 2006.

  1. Randy

    Randy Guest

    Here is the issue and maybe someone can shed some light on this, since
    I have been searching all day... I have an Unbound DropDownList that is
    in the edit template of a Bound detailview. No matter what I have
    tried I can not get the Dropdownlist value to update into the
    database.. I'm sure this has something to do with the finding the
    control (DDL) in the detailview, but no luck to this point. Any help
    would be great.

    Thanks...


    --Randy

    Code snipits as follows:

    <asp:SqlDataSource ID="DSDetail" runat="server" ConnectionString="<%$
    ConnectionStrings:ACChangeLogConnectionString %>"
    SelectCommand="Logdetails"
    SelectCommandType="StoredProcedure" UpdateCommand="UPDATE ACChange SET
    acTable = @acTable, Change = @Change, acMandatory = @acMandatory WHERE
    (UID = @UID)">
    <UpdateParameters>
    <asp:parameter Name="acTable" />
    <asp:parameter Name="Change" />
    <asp:parameter Name="acMandatory" />

    <asp:parameter Name="UID" />
    </UpdateParameters>
    ............
    <asp:DetailsView ID="DVLog" runat="server" AutoGenerateRows="False"
    CellPadding="4"
    DataSourceID="DSDetail" ForeColor="#333333"
    GridLines="None" Height="50px"
    Width="694px" DataKeyNames="UID">
    .........
    <EditItemTemplate>
    <asp:DropDownList ID="acMandatory"
    SelectValue='<%# Eval("acMandatory") %>' runat="server">
    <asp:ListItem Text="Yes"
    Value="Yes" />
    <asp:ListItem Text="No"
    Value="No" />
    </asp:DropDownList>

    </EditItemTemplate>
    Randy, May 5, 2006
    #1
    1. Advertising

  2. Randy

    Brock Allen Guest

    Try Bind() instead of Eval()

    -Brock
    http://staff.develop.com/ballen


    > Here is the issue and maybe someone can shed some light on this, since
    > I have been searching all day... I have an Unbound DropDownList that
    > is in the edit template of a Bound detailview. No matter what I have
    > tried I can not get the Dropdownlist value to update into the
    > database.. I'm sure this has something to do with the finding the
    > control (DDL) in the detailview, but no luck to this point. Any help
    > would be great.
    >
    > Thanks...
    >
    > --Randy
    >
    > Code snipits as follows:
    >
    > <asp:SqlDataSource ID="DSDetail" runat="server" ConnectionString="<%$
    > ConnectionStrings:ACChangeLogConnectionString %>"
    > SelectCommand="Logdetails"
    > SelectCommandType="StoredProcedure" UpdateCommand="UPDATE ACChange SET
    > acTable = @acTable, Change = @Change, acMandatory = @acMandatory
    > WHERE
    > (UID = @UID)">
    > <UpdateParameters>
    > <asp:parameter Name="acTable" />
    > <asp:parameter Name="Change" />
    > <asp:parameter Name="acMandatory" />
    > <asp:parameter Name="UID" />
    > </UpdateParameters>
    > ...........
    > <asp:DetailsView ID="DVLog" runat="server" AutoGenerateRows="False"
    > CellPadding="4"
    > DataSourceID="DSDetail"
    > ForeColor="#333333"
    > GridLines="None" Height="50px"
    > Width="694px" DataKeyNames="UID">
    > ........
    > <EditItemTemplate>
    > <asp:DropDownList ID="acMandatory"
    > SelectValue='<%# Eval("acMandatory") %>' runat="server">
    > <asp:ListItem Text="Yes"
    > Value="Yes" />
    > <asp:ListItem Text="No"
    > Value="No" />
    > </asp:DropDownList>
    > </EditItemTemplate>
    >
    Brock Allen, May 6, 2006
    #2
    1. Advertising

  3. Randy

    Randy Guest

    I believe I had tryed that and it did not change the outcome..

    Brock Allen wrote:
    > Try Bind() instead of Eval()
    >
    > -Brock
    > http://staff.develop.com/ballen
    >
    >
    > > Here is the issue and maybe someone can shed some light on this, since
    > > I have been searching all day... I have an Unbound DropDownList that
    > > is in the edit template of a Bound detailview. No matter what I have
    > > tried I can not get the Dropdownlist value to update into the
    > > database.. I'm sure this has something to do with the finding the
    > > control (DDL) in the detailview, but no luck to this point. Any help
    > > would be great.
    > >
    > > Thanks...
    > >
    > > --Randy
    > >
    > > Code snipits as follows:
    > >
    > > <asp:SqlDataSource ID="DSDetail" runat="server" ConnectionString="<%$
    > > ConnectionStrings:ACChangeLogConnectionString %>"
    > > SelectCommand="Logdetails"
    > > SelectCommandType="StoredProcedure" UpdateCommand="UPDATE ACChange SET
    > > acTable = @acTable, Change = @Change, acMandatory = @acMandatory
    > > WHERE
    > > (UID = @UID)">
    > > <UpdateParameters>
    > > <asp:parameter Name="acTable" />
    > > <asp:parameter Name="Change" />
    > > <asp:parameter Name="acMandatory" />
    > > <asp:parameter Name="UID" />
    > > </UpdateParameters>
    > > ...........
    > > <asp:DetailsView ID="DVLog" runat="server" AutoGenerateRows="False"
    > > CellPadding="4"
    > > DataSourceID="DSDetail"
    > > ForeColor="#333333"
    > > GridLines="None" Height="50px"
    > > Width="694px" DataKeyNames="UID">
    > > ........
    > > <EditItemTemplate>
    > > <asp:DropDownList ID="acMandatory"
    > > SelectValue='<%# Eval("acMandatory") %>' runat="server">
    > > <asp:ListItem Text="Yes"
    > > Value="Yes" />
    > > <asp:ListItem Text="No"
    > > Value="No" />
    > > </asp:DropDownList>
    > > </EditItemTemplate>
    > >
    Randy, May 7, 2006
    #3
    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. Henry Lee

    DetailView Data Update Error

    Henry Lee, Mar 2, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    948
    Henry Lee
    Mar 2, 2006
  2. Remy
    Replies:
    0
    Views:
    510
  3. =?Utf-8?B?QmVydA==?=

    detailview update

    =?Utf-8?B?QmVydA==?=, Jan 5, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    310
    =?Utf-8?B?QmVydA==?=
    Jan 5, 2007
  4. LamSoft

    Help... DetailView won't update...

    LamSoft, Jul 5, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    423
    LamSoft
    Jul 5, 2007
  5. Benedictum

    DropdownList fields in DetailView

    Benedictum, Apr 17, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    117
    Benedictum
    Apr 17, 2006
Loading...

Share This Page