DropDownLists get same value on all rows

Topics: Developer Forum
Feb 19, 2007 at 6:40 PM
Edited Feb 19, 2007 at 6:42 PM
I am using a BulkEditGridView that has several columns, only one of which is editable. Here's the main tag:

<rwg:BulkEditGridView ID="gvShipUpdate" runat="server" AutoGenerateColumns="False" DataSourceID="ScreenProd"
BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Vertical" AllowSorting="True"
BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" SaveButtonID="UpdateOrders" DataKeyNames="OrderMasterID" EnableInsert="False" InsertRowCount="1">

The editable column has a single DropDownList control with hard-coded list item values, and is being bound this way:

<asp:TemplateField HeaderText="Order Status" SortExpression="ShipStatus">
<asp:DropDownList id="ddlShipStatus" runat="server" SelectedValue='<%# Bind("ShipStatus") %>' __designer:wfdid="w2">
<asp:ListItem Value="" Text="" />
<asp:ListItem Value="P" Text="Printed" />
<asp:ListItem Value="S" Text="Shipped" />
<asp:ListItem Value="R" Text="Reprint" />
<asp:ListItem Value="W" Text="Waiting for Return" />
<asp:ListItem Value="I" Text="Incomplete" />

ShipStatus is a char(1) coming from a SQL Server database. For some reason, the data binding to this DropDownList is not working, and the same value is being bound to every row. I know the data is being updated correctly in the database since I've traced the database call (a stored procedure). It's just that the value I save for a given row is being applied to the DropDownList on-screen only, after I do the Update.

I'm using the BulkEditGridView code as-is, no changes to the class. What am I doing wrong? Many thanks for any pointers!

Feb 20, 2007 at 3:02 AM
Please disregard. I found the problem (it was in the stored procedure I was using to update the database). Sorry for the false alarm.