ItemDataBound issue

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

ashelley

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
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top