Forcing DataView to sort/filter without calling Control.DataBind?

  • Thread starter Thread starter ejstembler
  • Start date Start date
E

ejstembler

I've noticed that applying a Sort and/or RowFilter property to a
DataView does not take effect until you bind the DataView to a control
and call the control's DataBind method. I'm sure DataBind does some
"magic" internally to apply the sort and filter (perhaps even
generating a new DataView).

Does anyone know how to force the DataView to sort/filter with calling
a control's DataBind? Or even this there is some little-know method
for re-generating the view?

TIA
 
Nevermind. Shortly after posting this I found what I was doing wrong:

I was (incorrectly) doing this:

foreach (DataRow row in dataView.Table.Rows)

instead of (correctly) doing this:

foreach (DataRowView row in dataView)
 
Ejstembler,

Thanks for replying your question did look so crazy for me.

To explain what you do with this one.
DataView.Table gives back the original datatable.

Cor
 
Back
Top