ItemDataBound issue

  • Thread starter Thread starter Wayne Carlaw
  • Start date Start date
W

Wayne Carlaw

Why does the e.Item.Cells[3].Text value always return empty? Without this
routine (or if I comment out the guts), the text exists.

private void dg_ItemDataBound(Object sender, DataGridItemEventArgs e) {

if((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType ==
ListItemType.AlternatingItem)) {

string item = e.Item.Cells[3].Text;
e.Item.Cells[3].Text = item;

}

}

Thanks.
 
Why does the e.Item.Cells[3].Text value always return empty? Without this
routine (or if I comment out the guts), the text exists.

private void dg_ItemDataBound(Object sender, DataGridItemEventArgs e) {

if((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType ==
ListItemType.AlternatingItem)) {

string item = e.Item.Cells[3].Text;
e.Item.Cells[3].Text = item;

}

}

Thanks.

Check to see what is actually in the cell. Iterate over the Controls
collection in the cell. I find that sometimes The text might get
cautght up in a literal control item.

-Adam
 
Back
Top