using a dataview

C

Chris Barrow

Hi everyone,

I am trying to apply a dataview to a grid's datasource,
but it doesn't seem to be working. Here are the codes:

Dim objView as New DataView(odsMembers.Tables("DataTable"))
objView.RowFilter = "Active = " & mActive
e.DataSource = objView

(where mActive = true or false). The sql server equivalent
is bit of course, so I am not sure if I should use true or
false keywords or 1,0.

Again, I am only trying to show rows in the grid that
match this filter, but currently, all of the rows in the
original datatable are stilled being displayed. Have I
done something wrong here? Any feedback would be greatly
appreciated.

Thanks,

Chris...
 
B

Bernie Yaeger

Hi Chris,

I don't see anything wrong with the dataview, but here's what I'd suggest -
do a row count of the dataview to satisfy yourself that it's filtered
correctly. Once you have that, I think the more likely problem is that
you're not disconnecting the prior datatable from the grid as datasource.

Here I can't help you as I use C1 true db grid and its object model is quite
different than a regular grid, but I'm sure others can help explain 'how to
disconnect a datatable as datasource and replace it with another'.

HTH,

Bernie Yaeger
 
J

Jim Heavey

I am guessing the "e" is the name of your datagrid.

You will need to perform a rebind to repopulate the datagrid with the
vales of the adjusted view. You did not show that so I could not tell
if you were doing a rebind.

e.databind()
 
C

Chris Barrow

Bernie,

Thanks very much for your response. I will try this route
and go from there. At least I now know my code seems to be
correct.

Thanks,

Chris...
 
C

Chris Barrow

Jim,

Thanks for your response. I will give this a shot and see
how it goes.

Thanks,

Chris...
 

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