Binding to filtered rows

  • Thread starter Thread starter Roshawn
  • Start date Start date
R

Roshawn

Hi,

How do you databind to filtered rows of a DataView? Can I just bind to the
DataView or must the filtered rows be moved to some other container (like
another DataTable) and binding be done on the container?

Roshawn
 
Hi,

You could just bind to the DataView and it should work fine. DataView were
designed to provide this functionality
 
Thanks Val.

OK, so how do you bind to a particular column using a DataView? I've tried
the following, but it doesn't work:

Me.txtName.Text = dv.Item(0).Row.Item(0).GetType.ToString()

What am I doing wrong?

Roshawn
 
try this

txtName.databindings.add(byval "Text",DV,"ColumnID") etc

Text is the property of the textbox your binding to
DV is your Dataview
ColumnID is the name of your Column in the Dataview



john
 
Hi,

Me.txtName.Text = dv.Item(0).Row.Item(0).ToString()

should just populate your textbox with the value, but it does not bind it to
the column. If you need to provide binding to the column, then check
DataBindings property of the textbox control and next KB with an example

http://support.microsoft.com/default.aspx?scid=kb;en-us;317041&Product=adonet

But my personal opinion is that binding is not a good way to program,
because you would lose some sort of flexibility, when you rely in automatic
binding. Your code, which just assigns data to the textbox is a way to go
and should work, but it would require more coding from you to update dataset
 
Back
Top