开发者

how to prevent sorting in DataGridView? [closed]

Closed. This question needs to be more f开发者_如何学编程ocused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 7 years ago.

Improve this question

how to prevent sorting in DataGridView?


Winforms?

    for (int i = 0; i < this.dataGridView1.ColumnCount - 1; i++)
    {
        this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.Programmatic;
    }


I'll assume you mean sorting in a WPF DataGrid: Set CanUserSortColumns="False".


I am assuming you are talking about web page grid view

<asp:GridView AllowPaging=false ...


Or if it's a WinForms DataGridView you can set the sortmode of the columns as:

Column1.SortMode = NotSortable
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜