I'm trying to use the datagrid loadingrow event to color my row based on the value within the row. I have the following code within the loadingrow event handler:
<br />
DataRowView item = e.Row.Item as DataRowView;<br />
if (item != null)<br />
{<br />
}<br />
My problem is that the variable item is always null so my code never gets executed. I've used the debugger and when I view the "e.Row.Item" value, it does indeed show something besides "null." So, I'm at a loss for what would cause the assignment to result in "null" instead of the value I see as "e.Row.Item."
Can anyone shed any light on the problem and offer a solution?
I've inserted a "Console.WriteLine(e.Row.Item);" statement right after the above "if" statement and it indeed displays a value, not null!
Thanks in advance for the help.