如何在GridView中通过命令行使用“删除”按钮 [英] How to Use Delete button in GridView throught Command line

查看:84
本文介绍了如何在GridView中通过命令行使用“删除”按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用VB代码在GridView中通过命令行使用删除按钮?

How do I use a delete button in a GridView through Command line using VB Code behind?

推荐答案

这只是事件处理程序的一个示例喜欢:



This is just an example of what the event handler would look like:

protected void gvEntries_RowDeleting(object sender, GridViewDeleteEventArgs e)
       {
           //This will depend on how you are obtaining your data. If the data is from a database, you will have to delete the record in the database before databinding in order for the gridview to reflect it.
           gvEntries.DeleteRow(e.RowIndex);
           gvEntries.DataBind();
       }





此外,您还需要添加gvEntries_RowDeleting(或者您为gridview命名的任何内容)删除事件)到gridview标记的onrowdeleting事件属性。



Also, you will want to add "gvEntries_RowDeleting"(or whatever you name your gridview and its deleting event) to the onrowdeleting event attribute of your gridview markup.


这篇关于如何在GridView中通过命令行使用“删除”按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆