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" />

blog comments powered by Disqus

Who.I.am

Certified Umbraco, .net and Azure developer, seo lover. Magician in my spare time.

Month List