Filtering an editable datagrid

  • Thread starter Richard L Rosenheim
  • Start date
R

Richard L Rosenheim

I'm sure it can be done, I haven't been able to find the right article yet.

I want to be able to filter the records that the datagrid displays, but
still have an editable datagrid. That is, I only want records from the
table where "State= 'CA'" are to be displayed, but where the user can still
edit/add/delete records.

The only examples I have found utilizes DataViews, which apparently are not
editable. Can someone point me to the proper article?

TIA,

Richard Rosenheim
 
K

Ken Tucker [MVP]

Hi,

The dataview is editable. You also could filter the datagrid if you
are bound to a dataset.table(tablename) by using the
datatable.defaultview.rowfilter

Ken
---------------------
I'm sure it can be done, I haven't been able to find the right article yet.

I want to be able to filter the records that the datagrid displays, but
still have an editable datagrid. That is, I only want records from the
table where "State= 'CA'" are to be displayed, but where the user can still
edit/add/delete records.

The only examples I have found utilizes DataViews, which apparently are not
editable. Can someone point me to the proper article?

TIA,

Richard Rosenheim
 
G

Guest

Hi all,

Am I doing something wrong here? I'm just trying to filter my datagrid with
the DefaultView.RowFilter method.

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
DataGrid1.DataSource = m_dt
DataGrid1.DataMember = "Orders"
Dim myFilter = "CustomerID = " & m_bo.CustomerID
m_dt.DefaultView.RowFilter = myFilter
End Sub

rodchar
 
R

Richard L Rosenheim

What is m_dt?

With datatables and datagrids, the RowFilter methods takes a string. The
following should work::
m_dt.DefaultView.RowFilter = "CustomerID=" & m_bo.CustomerID.ToString

Richard Rosenheim
 
R

Richard L Rosenheim

Thanks for the replies. I'm making some headway.

One of my mistakes was that to keep the datatable ID columns from appearing
in the grid, I set the column mapping for those columns to hidden. That had
some negative side effects. I guess I'm going to have to manipulate the
grid style to just hide the columns there.

The other problem I'm having is that the datagrid column containing the
parent ID is not automatically populated. At some point, when an user
enters a new row, I'm going to have to populate that column (and presumably
before it's actually added to the dataset). Can someone point in the right
direction? I didn't see any events which would appear to be of help.
TIA,

Richard Rosenheim
 

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