<asp:ObjectDataSource ID="sourceGroups" runat="server"
TypeName="Kurs4.Code.GroupDB" SelectMethod="GetGroups">
</asp:ObjectDataSource>
<asp:ListBox ID="lstGroups" runat="server" DataSourceID="sourceGroups"
DataTextField="GroupName"></asp:ListBox>
<asp:Button ID="btnDeleteGroup" runat="server" Text="Delete"
onclick="btnDeleteGroup_Click"/>
I have a list of Group which is populated in the ListBox. Group class has a GUID id. I need to delete selected Group from the ListBox and datasource upon Button click.
How is it possible? The problem is to get the ID of the selected item in the ListBox, because many groups can have the same GroupName.