简体   繁体   中英

ListView Retrieving Value in Code Behind File aspx.cs

This issue may be simple but I am having some trouble with it. I have a listview and have an "OnItemDeleting" event set up to fire as the item is deleted. I would like to retrieve the values of the item that is being deleted in this "OnItemDeleting" event in the code behind value. Could anyone give me any tips on how to go about doing this?

=================================================================================== Listview instance in .aspx file:

<asp:ListView ID="ListViewMngArtwork" runat="server" Visible="true" 
        DataKeyNames="artworkID" DataSourceID="SqlDataSourceMngArtwork" 
        GroupItemCount="3" OnItemDeleting="ListViewMngArtwork_OnItemDeleting"/>

=================================================================================== Event instance in .aspx.cs file:

protected void ListViewMngArtwork_OnItemDeleting(object sender, EventArgs e)
{}

===================================================================================

you can get the Item index, key and value in your event:

protected void ListViewMngArtwork_OnItemDeleting(object sender, ListViewDeleteEventArgs e)
{
    e.ItemIndex
    e.Keys
    e.Values
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM