Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Help with dataset and datagrids

Reply
Thread Tools

Help with dataset and datagrids

 
 
=?Utf-8?B?Q2hyaXM=?=
Guest
Posts: n/a
 
      04-14-2005
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

 
Reply With Quote
 
 
 
 
Elton Wang
Guest
Posts: n/a
 
      04-14-2005
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
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataSet and dataSet JimO ASP .Net 2 03-08-2006 02:39 PM
Help with dependent drop down lists and datagrids Megan green via .NET 247 ASP .Net Datagrid Control 0 03-25-2005 07:23 PM
Difference Between Typed Dataset and Untyped Dataset thomson ASP .Net 2 01-19-2005 08:16 AM
Filling two datagrids from two SELECTS in one DataSet DC Gringo ASP .Net 2 02-26-2004 09:56 PM
Ccopying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N ASP .Net 1 10-31-2003 02:39 AM



Advertisments