In order to sort a datagrid, you need sort the datagrid's underlying data
source, i.e. DataTable (actually DataView). Following code shows how to
sort:
DataView dv = datatable.DefaultView;
dv.Sort = "filed_name";
// or descending
dv.Sort = "filed_name DESC";
datagrid.DataSource = dv;
datagrid.DataBind();
HTH
> Hello,
>
[quoted text clipped - 5 lines]
>
> thanx for reply.
--=OpTyLeR=-- - 27 Feb 2006 16:59 GMT
Thank's Elton for the reply,
but your answer don't solve my mistake :'(
the fact datas in the first dataView are IDs and not by Names don't sort the
list alphabetically ...
I take the names of columns with the DataGridTextBoxColumn class.
Sample of my code :
DataGridTableStyle tableStyleBilan = new DataGridTableStyle();
tableStyleBilan.MappingName =
_baseh.getTableHepato(Bilan.TABLE_NAME).tableName;
JoinTextBoxColumn colExamen = new
JoinTextBoxColumn(Bilan.EXAMEN_BILAN_RELATION,
_nouveaudataset.Tables["examen"].Columns["Nom"]);
colExamen.MappingName = "IdExamen";
colExamen.HeaderText = "Examen";
colExamen.Width = 150;
tableStyleBilan.GridColumnStyles.Add(colExamen);
thank's again
"Elton Wang" a écrit :
> In order to sort a datagrid, you need sort the datagrid's underlying data
> source, i.e. DataTable (actually DataView). Following code shows how to
[quoted text clipped - 17 lines]
> >
> > thanx for reply.