B
Bamse
hi, i have this problem:
at runtime i add rows to a grid (actually to a datatable, that the grid is
binded to)
but the row is added down, after the existing rows and i want it to be the
first shown in grid;
i tried with dataview.sort = "<field> DESC"; but it didn't work
i tried using
dv.ListChanged += new
System.ComponentModel.ListChangedEventHandler(DataView_ListChanged);
protected virtual void DataView_ListChanged(object sender,
System.ComponentModel.ListChangedEventArgs args)
{
if ( (args.ListChangedType == ListChangedType.ItemAdded) |
(args.ListChangedType == ListChangedType.ItemDeleted) )
{
CurrencyManager cm = (CurrencyManager)this.BindingContext[DataSet,
the Relation];
DataView dv = (DataView)cm.List;
dv.Sort = "Position DESC";
cm.refresh();
this.grid.SetDataBinding(null, null);
this.grid.SetDataBinding(DocDataSet, "theRelation");
}
but that didn't worked either
what's wrong?
Thank you,
Daniel
at runtime i add rows to a grid (actually to a datatable, that the grid is
binded to)
but the row is added down, after the existing rows and i want it to be the
first shown in grid;
i tried with dataview.sort = "<field> DESC"; but it didn't work
i tried using
dv.ListChanged += new
System.ComponentModel.ListChangedEventHandler(DataView_ListChanged);
protected virtual void DataView_ListChanged(object sender,
System.ComponentModel.ListChangedEventArgs args)
{
if ( (args.ListChangedType == ListChangedType.ItemAdded) |
(args.ListChangedType == ListChangedType.ItemDeleted) )
{
CurrencyManager cm = (CurrencyManager)this.BindingContext[DataSet,
the Relation];
DataView dv = (DataView)cm.List;
dv.Sort = "Position DESC";
cm.refresh();
this.grid.SetDataBinding(null, null);
this.grid.SetDataBinding(DocDataSet, "theRelation");
}
but that didn't worked either
what's wrong?
Thank you,
Daniel