单击ASP.NET中的编辑按钮后,避免使用gridview编辑模式 [英] Avoid gridview edit mode after click on edit button in ASP.NET

查看:57
本文介绍了单击ASP.NET中的编辑按钮后,避免使用gridview编辑模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从代码后面绑定了gridview,我也生成了行编辑事件。但是不想在行编辑活动中使用网格视图编辑模式



我尝试过:



我试过给editindex = -1

I have binded gridview from code behind also I have generated Row Editing event. But dont want grid view edit mode on Row Editing event

What I have tried:

I have tried giving editindex = -1

推荐答案

如果你不希望用户能够编辑一行,那么它就不会没有任何意义有一个编辑按钮。



但是,如果你想取消编辑,你只需要设置 e .Cancel = true

If you don't want the user to be able to edit a row, then it doesn't make any sense to have an "Edit" button.

But, if you want to cancel the edit, you just need to set e.Cancel = true:
protected void GridView_RowEditing(object sender, GridViewEditEventArgs e)
{
    e.Cancel = true;
}


这篇关于单击ASP.NET中的编辑按钮后,避免使用gridview编辑模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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