简体   繁体   English

asp.net ListView属性

[英]asp.net ListView properties

I have an asp:listView which displays some IEnumerable objects supplied by a stored procedure from the DB. 我有一个asp:listView,它显示了数据库中存储过程提供的IEnumerable对象。

How is it possible to delete each entry with the help of a button? 如何通过按钮删除每个条目? ie: if you click on a row you get the option to delete it. 即:如果您单击一行,则可以选择将其删除。

In the options, Editing, Inserting, Deleting are grayed out and cannot be selected. 在选项中,“编辑”,“插入”,“删除”显示为灰色,无法选择。

i think they might be grayed out because you are not directly connection the listview to the database. 我认为它们可能会变灰,因为您没有直接将listview连接到数据库。 You should be able to get the selected item (or items) from the listview and if they have some sort of ID field stored in a property you can delete it from the object supplier, call delete to the database and then delete it from the listview. 您应该能够从列表视图中获取选定的一个或多个项目,并且如果它们在属性中存储了某种ID字段,则可以将其从对象供应商中删除,调用delete到数据库,然后将其从列表视图中删除。

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

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