This is a migrated thread and some comments may be shown as answers.

ItemDataBound

1 Answer 39 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Zed
Top achievements
Rank 1
Zed asked on 09 Oct 2008, 06:33 PM

 

public void rgTickets_ItemDataBound(object sender, GridItemEventArgs e)

 

{

 

if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item)

 

{

 

if (e.Item.Cells[5].Text == PriorityType.PriorityName.Critical.ToString())

 

{

e.Item.Cells[5].Style.Add(

"background-color", "red");

 

}

}

}



How do I get around finding the cell by Index?   If the columns are moved around it will not find the correct cell.   I would like to change it to something else.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Oct 2008, 05:39 AM
Hi Zed,

Try accessing the cells of a Grid using the column's UniqueName property. Go through the following help article for getting more information.
Accessing cells and rows

Regards
Shinu.

Tags
General Discussions
Asked by
Zed
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or