How can i deselect a selected record in a listview?
I have the following button in the SelectedItemTemplate of my ListView:
<asp:Button ID="Button2" runat="server" Text="Deselect" CommandName="Cancel"/>
But it doesn’t work, I get an error saying that I can use Cancel command only for updated or inserted records.
You should set the SelectedIndex on the ListView to -1
MSDN: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listview.selectedindex.aspx