DataView Row Filter isn't working

K

Kim

I need to filter this datatable but when I do it gives me all the data
not filter not sure what Im doing wrong.


DataView dv = new DataView();
dv.RowFilter = "ClientID = " + clientid;
gridControl1.DataSource = dv;

I also tried adding this but it didn't work either:
dv.RowStateFilter = DataViewRowState.ModifiedCurrent;

when I added the Row State Filter after the Row Filter no records was
return.
Any help will be greatly appreciated.
Thanks
Kim
 
Y

Yunus Emre ALPÖZEN [MCAD.NET]

What about datatable? where is it? My advice u to use DefaultView property
of datatable
 
J

joelcochran

I modified this for you from some working production code:

<code>
DataView dv = new DataView( %DATATABLE% , %FILTER_STRING% ,
%ORDER_BY_STRING% , DataViewRowState.CurrentRows );
gridControl1.SetDataBinding( this.currentView , null );
</code>

Replace the %...% markers above with your variabIes and use the
SetDataBinding method instead of just setting the DataSource property.
Works great for me...

HTH,
Joel
 
M

Maqsood Ahmed

Hello,
Have you tried putting single quotes around clientID?

something like
dv.RowFilter = "ClientID = '" + clientID + "'";??

Trying using it, it should help.

Maqsood Ahmed [MCP,C#]
Kolachi Advanced Technologies
http://www.kolachi.net
 

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

Top