Last post Apr 28, 2005 09:19 AM by Bug_Bugger
Apr 27, 2005 02:11 PM|BillyWilly|LINK
I have code working which uses a "Helper function" to do formatting. I'd like to get rid of it and move it completely to CodeBehind in an ItemDataBound event but am having problems.
In the Datagrid there is a "Cells" collection which lets me access column data - but in the Repeater - I cannot figure out how to get a particular columns' data. I'm really having trouble with the e.Item.properties.
I'd like to have something like this:
If e.Item.DataItem.Cells("Age") > 21 Then
e.Item.DataItem.Cells("Name") .Font = SomeCrazyFont
If I have rows of Person data with three columns, (ID, Name, Age) and I want to change the font of the Name based on age. I need to format the data in column 2 based on the data in column 3 of the same row of data.
My current InLine code is like this:
<td><% D_Format(Container.DataItem("Age"), Container.DataItem("Name")) %></td>
ANY help is appreciated - B
Apr 27, 2005 06:38 PM|Bug_Bugger|LINK
Apr 27, 2005 06:56 PM|BillyWilly|LINK
Yah - Option #2 is more tedious than the "Inline Helper".
However, I do not know how to "change" the formatting of a column even though I know how to get to the data using Item.DataItem. This is really the crux of my question. Must I use controls to change the formatting?
Apr 28, 2005 09:19 AM|Bug_Bugger|LINK