这意味着GridView1.EditIndex = -1; [英] Whta does it mean GridView1.EditIndex= -1;

查看:228
本文介绍了这意味着GridView1.EditIndex = -1;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在大多数gridview中它始终是写的



in most of the gridview's it is always written

GridView1.EditIndex= -1;





谁能详细告诉我它是什么用的..?



can anyone tell me in detail whats the use of it..?

推荐答案

如果你想要的话取消网格视图中的编辑模式..设置GridName.EditIndex = -1;



我们通常在GridView中使用内置的编辑功能时使用它。



例如:如果你想在编辑模式下在网格内显示第3条记录



GridName.EditIndex = 2;



编辑后,点击保存



GridName.EditIndex = -1; // - 这样它就会恢复正常视图
If you want to cancel the Edit mode in Grid view.. set GridName.EditIndex=-1;

We usually use this when you use built in Edit Functionality inside the GridView.

Eg: If you want to display 3rd record inside the grid in Edit mode

GridName.EditIndex=2;

After Editing, on click of Save

GridName.EditIndex=-1; //-So that it goes back to normal view


每当你编辑gridview时,一个editindex正在工作。



通过设置

Whenever you edit gridview a editindex is working.

by setting
GridView1.EditIndex= -1;



Gridview从编辑模式切换到正常模式。


Gridview changed into normal mode from EDit mode.


Asp.net网格视图具有gridviewrows的列表或数组,并且因为所有列表和数组都是起始索引是0,所以如果你将网格视图的编辑索引设置为0或1或任何其他它将在编辑模式下创建索引行。因此,如果您只需要只读模式的网格视图,则需要将-1设置为编辑索引。 -1表示没有行处于编辑模式。
Asp.net grid view is having list or array of gridviewrows, and as all the list and array are starting index is 0, so if you set edit index of grid view to 0 or 1 or any other than it will make that indexed row in edit mode. so if you need your grid view in only read only mode then you need to set -1 as edit index. -1 means no row are in edit mode.


这篇关于这意味着GridView1.EditIndex = -1;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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