简体   繁体   English

ListView在文件aspx.cs后面的代码中检索值

[英]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. 我有一个listview并设置了一个“OnItemDeleting”事件,以便在项目被删除时触发。 I would like to retrieve the values of the item that is being deleted in this "OnItemDeleting" event in the code behind value. 我想在代码隐藏值中检索此“OnItemDeleting”事件中正在删除的项的值。 Could anyone give me any tips on how to go about doing this? 谁能给我任何关于如何做到这一点的提示?

=================================================================================== Listview instance in .aspx file: ================================================== ================================= .aspx文件中的Listview实例:

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

=================================================================================== Event instance in .aspx.cs file: ================================================== ================================= .aspx.cs文件中的事件实例:

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

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

you can get the Item index, key and value in your event: 您可以在事件中获取Item索引,键和值:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用jQuery load()调用.aspx.cs代码后面的函数 - Calling a function in the .aspx.cs code behind file with jQuery load() 创建代码隐藏文件-aspx.cs - Creating Code-Behind file - aspx.cs 如何从类文件(.cs)文件调用函数到文件(.aspx.cs)之后的另一个代码? - How to call function from class file (.cs) file to another code behind file (.aspx.cs)? 将引导程序代码与.aspx.cs文件链接 - Linking bootstrap Code with .aspx.cs file 如何在文件 .aspx.cs 文件后面的 C# 代码中从 .js 文件访问 javascript 对象 - How to access a javascript object from .js file in C# code behind file .aspx.cs file 如何从aspx.cs文件复制一个aspx ListView? - How to copy an aspx ListView from the aspx.cs file? 从控制器方法调用文件(aspx.cs文件)后面的代码内部方法 - call to method inside code behind file(aspx.cs file) from controller method 在aspx.cs(在后面的代码)asp.net中创建RequiredFieldValidator - Make RequiredFieldValidator in aspx.cs (code behind) asp.net 在aspx.cs代码中检索当前Sharepoint用户 - Retrieving Current Sharepoint User in aspx.cs Code 在按钮上,单击发送Ajax调用并从aspx.cs(后面的代码)获取值到aspx页面,并将其显示在同一页面的输入字段中 - On button click send Ajax call and get value from aspx.cs(code behind) to aspx page and display it in input field in the same page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM