datagrid webcontrol in C#

G

Guest

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.
 
C

Cor Ligthert

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.MyColumn=="") {
//Do what you want to do}}
///
Written in this message so watch typos.

I hope this helps,

Cor
 
G

Guest

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
(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

Top