Help with dataset and datagrids

Discussion in 'ASP .Net' started by =?Utf-8?B?Q2hyaXM=?=, Apr 14, 2005.

  1. 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
    =?Utf-8?B?Q2hyaXM=?=, Apr 14, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?Q2hyaXM=?=

    Elton Wang Guest

    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




    >-----Original Message-----
    >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
    >
    >.
    >
    Elton Wang, Apr 14, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JimO

    DataSet and dataSet

    JimO, Mar 1, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    509
    Mary Chipman [MSFT]
    Mar 8, 2006
  2. Andrzej Wegrzyn
    Replies:
    2
    Views:
    712
    John Saunders
    Aug 18, 2003
  3. DC Gringo
    Replies:
    2
    Views:
    2,285
    Nikhil Patel
    Feb 26, 2004
  4. thomson
    Replies:
    2
    Views:
    14,819
    Eliyahu Goldin
    Jan 19, 2005
  5. Megan green via .NET 247

    Help with dependent drop down lists and datagrids

    Megan green via .NET 247, Mar 25, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    138
    Megan green via .NET 247
    Mar 25, 2005
Loading...

Share This Page