DataGridViewComboBoxColumn Column2 = new DataGridViewComboBoxColumn();
Column2.DisplayStyleForCurrentCellOnly = true;
Column2.FillWeight = 98.41095F;
Column2.FlatStyle = System.Windows.Forms.FlatStyle.System;
Column2.HeaderText = "نام کالا";
Column2.Name = "Column2";
Column2.Resizable = System.Windows.Forms.DataGridViewTriState.False;
//Column2.Sorted = true;
Column2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
Column2.ValueMember = "Name";
gridsabtekala.Columns.AddRange(new DataGridViewColumn[] { Column2 });
var v = (from a in linqedit.KalaNames
select a.Name).ToList();
Column2.DataSource = v;
答案 0 :(得分:0)
使用LINQ OrderBy
:
var v = (from a in linqedit.KalaNames
select a.Name).OrderBy(n => n.Name).ToList();
Column2.DataSource = v;