Hi David,
Using InsertItemTemplate to insert data, there is no data to be bound to
the FormView when Insert button is clicked in FormView.
Using EditItemTemplate to update data, the data will be rebound to the
EditItemTemplate When the Edit button is clicked. In this case, ASP.NET
will check whether the Field "employeeID" exists.
So please make sure this field is included in the select statement of
FormView.
For more information about using the FormView to do flexible data
modification, see
http://www.asp.net/learn/data-access...ial-16-cs.aspx (Section: Using
the FormView for a More Flexible Data Modification User Interface).
I look forward to receiving your test results.
--------------------
|
| 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:
|
|
|
| <asp

ropDownList runat="server" ID="ddlRequestor"
| DataSourceID="SQLDataSourceRequestors" DataTextField="Name"
| DataValueField="EmployeeID" SelectedValue='<%# Bind("EmployeeID")
| %>'></asp

ropDownList>
|
|
| 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?
|
|
Best Regards,
Thomas Sun
Microsoft Online Partner Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.