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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top