代码改变世界

重置GrindConrol焦点行FocusedRowHandle

2020-11-14 10:37  默默的码农哥  阅读(567)  评论(0编辑  收藏  举报

List<model> list=this.CurrentList;

var selectModel=tempselectmodel;

//找selectModel在list中得位置

var index=list.indexOf(selectModel);

//获取在gridview中得位置

var focusRowHandle=GridView1.GetRowHandle(index);

//重置gridview得焦点行

GridView1.FocusedRowHandle=focusRowHandle;