Home All Groups Group Topic Archive Search About

Update From DropDownList in DetailView

Author
5 May 2006 7:22 PM
Randy
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>

Author
6 May 2006 7:03 PM
Brock Allen
Try Bind() instead of Eval()

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


Show quoteHide quote
> 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>
>
Author
7 May 2006 6:50 PM
Randy
I believe I had tryed that and it did not change the outcome..

Brock Allen wrote:
Show quoteHide quote
> 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>
> >