rangerstud620 Posted May 9, 2006 Posted May 9, 2006 I'm using a DetailsView to update a SQL database. One row in the DetailsView contains a dropdownlist with a value = Heading and text = Headname. When the database is updated though, the Heading and Headname fields are both filled with the Heading value. I have separate parameters set up for each, so I can't figure out how both Heading and Headname are getting the same value. I'm sure it's something simple but I just cannot see it. Any ideas? Thanks! <asp:TemplateField HeaderText="YP Heading" SortExpression="HEADNAME"> <EditItemTemplate> <asp:DropDownList ID="ddlHeadings" runat="server" DataSourceID="dsHeadings" DataTextField="HEADNAME" DataValueField="HEADING" Width="650px" SelectedValue='<%# Bind("HEADING","{0}") %>' EnableTheming="True"> </asp:DropDownList><asp:SqlDataSource ID="dsHeadings" runat="server" ConnectionString="<%$ ConnectionStrings:TestCompany %>" SelectCommand="SELECT [HEADING], [HEADNAME] FROM [HEADINGS] ORDER BY [HEADING]"> </asp:SqlDataSource> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("HEADNAME") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:SqlDataSource ID="dsCompany" runat="server" ConnectionString="<%$ ConnectionStrings:TestCompany %>" SelectCommand="SELECT * FROM [NewReport] WHERE ([sORTCODE] = @SORTCODE) ORDER BY [LINENUMBER]" UpdateCommand="UPDATE NewReport SET HEADING = @Heading, HEADNAME = @Headname, CHANGES = @Changes, COMMENTS = @Comments WHERE SORTCODE = @Sortcode"> <SelectParameters> <asp:ControlParameter ControlID="lstCompany" Name="SORTCODE" PropertyName="SelectedValue" /> </SelectParameters> <UpdateParameters> <asp:ControlParameter ControlID="DetailsView1$ddlHeadings" Name="Headname" PropertyName="text" Type="string" /> <asp:Parameter Name="Heading" Type="string" /> <asp:Parameter Name="Changes" Type="string" /> <asp:Parameter Name="Comments" Type="string" /> <asp:Parameter Name="Sortcode" Type="string" /> </UpdateParameters> </asp:SqlDataSource> Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.