I changed the code (below ) but get this error:
ERROR:
Exception Details: System.InvalidCastException: Specified cast is not valid.
Source Error:
Line 51: Case ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItem
Line 52: Dim myDeleteButton As LinkButton
Line 53: myDeleteButton = e.Item.FindControl("btnDelete")
Code <HTML>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton runat="server" ID="btnDelete" Text="Delete" CommandName="Delete" CausesValidation="false"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</HTML>
<CodeBehind>
Select Case e.Item.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItem
Dim myDeleteButton As LinkButton
myDeleteButton = e.Item.FindControl("btnDelete")
myDeleteButton.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this company?');")
End Select
</codebehind>
Can you see what dummy mistake I am making now?