Binding to filtered rows

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
 
V

Val Mazur

Hi,

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

Roshawn

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
 
J

John Mas

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
 
V

Val Mazur

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
 

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