D
David
I have a formview item that displays a record. That record comes from the
Quotes table. One of the fields is the Requestor field. When creating a new
record, I display a dropdownlist that contains employee records from the
Employee table. The employee table has an EmployeeID field and a Name field.
So, in the InsertItemTemplate of the formview object, I have this:
<aspropDownList runat="server" ID="ddlRequestor"
DataSourceID="SQLDataSourceRequestors" DataTextField="Name"
DataValueField="EmployeeID" SelectedValue='<%# Bind("EmployeeID")
%>'></aspropDownList>
Excellent. Works perfect. On the Inserting event, I grap the ID selected
in the dropdownlist, and put it into the Insert statement for the formview.
Now, I go to edit the record. I use the exact same code in my
EditItemTemplate. (I just copied and pasted the code, so I know it’s the
same thing.)
As soon as I hit the “Edit†button, I get an exception
DataBinding: 'System.Data.DataRowView' does not contain a property with the
name 'EmployeeID'.
So, what’s different when running the EditItemTemplate, compared with the
InsertItemTemplate?
Quotes table. One of the fields is the Requestor field. When creating a new
record, I display a dropdownlist that contains employee records from the
Employee table. The employee table has an EmployeeID field and a Name field.
So, in the InsertItemTemplate of the formview object, I have this:
<aspropDownList runat="server" ID="ddlRequestor"
DataSourceID="SQLDataSourceRequestors" DataTextField="Name"
DataValueField="EmployeeID" SelectedValue='<%# Bind("EmployeeID")
%>'></aspropDownList>
Excellent. Works perfect. On the Inserting event, I grap the ID selected
in the dropdownlist, and put it into the Insert statement for the formview.
Now, I go to edit the record. I use the exact same code in my
EditItemTemplate. (I just copied and pasted the code, so I know it’s the
same thing.)
As soon as I hit the “Edit†button, I get an exception
DataBinding: 'System.Data.DataRowView' does not contain a property with the
name 'EmployeeID'.
So, what’s different when running the EditItemTemplate, compared with the
InsertItemTemplate?