Error: Update can only be called on a valid data item.

by Damiaan Peeters 31. August 2010 20:12

I had this in a ListView with an EntityDatasource.  But only the ListView had to do something with it…

Cause & solution

You did a copy paste from the EditItemTemplate to the InsertItemTemplate. 

The edit command is not allowed use the Insert command.

Change this:

<asp:Button ID="UpdateButton" runat="server" CommandName="Update"  Text="Update" />

To:

<asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />

Who.I.am

Certified Umbraco Master, Part of Umbraco Certified partner comm-it, .Net and Azure developer, seo lover. Magician in my spare time.

Month List