Sort() : JoinTextBoxColumn - DataGridTextBoxColumn

E

Elton Wang

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
 
O

--=OpTyLeR=--

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 :
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,139
Messages
2,570,806
Members
47,352
Latest member
Maricruz09

Latest Threads

Top