如何在webform中重新排序网格视图列 [英] How to reorder grid view column in webform

查看:81
本文介绍了如何在webform中重新排序网格视图列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改c后面的代码后面的asp gridview列索引



我尝试了什么:



grdFinancialDetail.Rows [1] .Cells [1] .TabIndex = 1;

how to change asp gridview column index on code behind in c #

What I have tried:

grdFinancialDetail.Rows[1].Cells[1].TabIndex = 1;

推荐答案

TabIndex不会改变顺序GridView中的列。您可以在代码隐藏中修改Gridview的Columns集合,方法是从集合中的当前位置删除该列,然后将其重新插入新位置。



例如,如果您想将第二列移动到您可以执行的第一列:



TabIndex will not change the order of columns in your GridView. You can modify the Gridview's Columns collection in your code-behind by removing the column from its current position in the collection and then re-insert it into the new position.

For example, if you wanted to move the second column to be the first column you could do:

var columnToMove = GridView1.Columns[1];
GridView1.Columns.RemoveAt(1);
GridView1.Columns.Insert(0, columnToMove);


这篇关于如何在webform中重新排序网格视图列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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