Help with dataset and datagrids

G

Guest

Hi,
I have the following dataset
Loc Qty Amt
OH 5 2
NC 4 1
OH 2 4

I have two datagrids on the same page one for OH and the other for NC. Is it
possible to select only OH rows from one dataset for the first datagrid and
NC rows frm the same dataset for the second datagrid. Instead of executing
two select statements and two

datagrid1.datasource = ds1
datagrid1.databind
datagrid2.datasource.ds2
datagrid2.databind



Thanks
 
E

Elton Wang

Hi Chris,

You can use dataview to perform your task:
Dim dvOH As DataView = ds.Tables(0).DefaultView
dvOH.RowFilter = "Loc='OH'"
datagrid1.datasource = dvOH
datagrid1.databind()

Dim dvNC As DataView = ds.Tables(0).DefaultView
dvNC.RowFilter = "Loc='NC'"
datagrid2.datasource = dvNC
datagrid2.databind()

HTH

Elton Wang
(e-mail address removed)
 

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

Similar Threads

dataset question 12
Help with passing test 3
Help with code plsss 0
Please help 2
Help with my responsive home page 2
Binding Datagrids 0
I dont get this. Please help me!! 2
Need help with this script 4

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top