简体   繁体   中英

How to set Row Filter for Dataview to filter rows according to valu of column?

Hii, I am using DataView control to bind a gridview. In dataview data is coming from a table 'cloneUserEntry'. cloneUserEntry table contains a column 'Visibility' whose value is true or false (boolean type). I want to display rows whose visibility is true. So how to set row filter to filter rows whose column 'visiility' contains only true. I am using code as following..

Boolean var=true ;
gvUserDataReadOnly.DataSource = new DataView(cloneUserEntry, string.Format("Visibility = #{0}#", var),  "FirstName ASC", DataViewRowState.CurrentRows);

but this is not working. can anyone ell me how to do this task..?? Thanks in advance..

Try removing the # characters from the filter statement, ie, "Visibility = true" instead of "Visibility = #true#" . The # are used when filtering using DateTime objects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM