Conversion Error

G

Guest

When I run the following code:

{
if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item ||
(e.Item.ItemType ==
System.Web.UI.WebControls.ListItemType.AlternatingItem))
{
int i = e.Item.Cells[6];
string s = i.ToString();
if (s == "0")
{
e.Item.Cells[0].Text = "NO";
}
}

I am getting the following error:

Cannot explicity convert type 'System.Web.WebUI.WebControls.TableCell' To int

What do I need to cnage to make this work?

Thanks,

Dave
 
O

Ollie Riches

if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item ||
(e.Item.ItemType ==
System.Web.UI.WebControls.ListItemType.AlternatingItem))
{
if (e.Item.Cells[6].Text == "0")
{
e.Item.Cells[0].Text = "NO";
}

HTH

Ollie Riches
 

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