DataRowView

G

Guest

Hello All:

How have you used the DataRowView. I am familiar w/ DataRow (of course!),
but haven't had the need to use the DataRowView. When would you use it?

Thanks.

Joe
 
G

Guest

Hi Joe,

Although you are not familiar with DataRowView, you are properly familiar
with DataView. By using DataView, you can either sort data or filter data in
datatabel. After sorting or filtering data, you can loop thru dataview by
datarowview. Following code snippet shows how to use datarowview:

DataView dv = datatableObj.DefaultView;
dv.Sort = “Sort_Fieldâ€;
dv.RowFielter = condition; // like sql query without WHERE
//loop thru
Foreach (DataRowView drv in dv)
{
int intData = (int)drv[“Field_Nameâ€]; // or (int)drv[col_index];
}

There are also many other cases to use DataRowView, such as in ItemDataBound
event of DataGrid, DataList, or Repeater, and so on.



HTH

Elton Wang
 
G

Guest

Thank you Elton.
--
Joe


Elton W said:
Hi Joe,

Although you are not familiar with DataRowView, you are properly familiar
with DataView. By using DataView, you can either sort data or filter data in
datatabel. After sorting or filtering data, you can loop thru dataview by
datarowview. Following code snippet shows how to use datarowview:

DataView dv = datatableObj.DefaultView;
dv.Sort = “Sort_Fieldâ€;
dv.RowFielter = condition; // like sql query without WHERE
//loop thru
Foreach (DataRowView drv in dv)
{
int intData = (int)drv[“Field_Nameâ€]; // or (int)drv[col_index];
}

There are also many other cases to use DataRowView, such as in ItemDataBound
event of DataGrid, DataList, or Repeater, and so on.



HTH

Elton Wang

Joe said:
Hello All:

How have you used the DataRowView. I am familiar w/ DataRow (of course!),
but haven't had the need to use the DataRowView. When would you use it?

Thanks.

Joe
 

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