Hi,

I just have a simple question regarding dataGrid in ADO.NET. I developed the
web application by ASP.net and C#. I want to implment a dataGrid for the
product list. The product list display the product name, size, type, price
.... But for the specfic product category, its size column may not has any
data. So i want to write the code in back-end by C# to determin whether every
item in the size column in dataGrid has data. How I can write it in C# ?

is there methods I can use to determin every item in size column contains
data ?

Thank you,
H.

Re: datagrid webcontrol in C# by Cor

Cor
Sun Jun 26 01:16:06 CDT 2005

H,

Every datagrid represents "data". When you have done that data in a
datatable. Than it is very easy to check if a item in a column has data

\\\
for (int i;i>dt.Table[x].Rows.Count;i++)
{if(dt.Table[x].Rows[i].MyColumn=="") {
//Do what you want to do}}
///
Written in this message so watch typos.

I hope this helps,

Cor



RE: datagrid webcontrol in C# by EltonW

EltonW
Sun Jun 26 14:59:03 CDT 2005

You can have logic in datagrid_ItemDatabound event:

if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
if (e.Item.Cells[size_index].Text.Equals(""))
{
// no size data
}
}


HTH

Elton Wang
elton_wang@hotmail.com


"H." wrote:

> Hi,
>
> I just have a simple question regarding dataGrid in ADO.NET. I developed the
> web application by ASP.net and C#. I want to implment a dataGrid for the
> product list. The product list display the product name, size, type, price
> .... But for the specfic product category, its size column may not has any
> data. So i want to write the code in back-end by C# to determin whether every
> item in the size column in dataGrid has data. How I can write it in C# ?
>
> is there methods I can use to determin every item in size column contains
> data ?
>
> Thank you,
> H.