private IHasAttributes GetAttributeObject(GridViewRow row)
{
// Get the parent grid
var grid = row.NamingContainer as Grid;
// check to see if there is an object list for the grid
if ( grid != null && grid.ObjectList != null )
{
// If an object list exists, check to see if the associated object has attributes
string key = grid.DataKeys[row.RowIndex].Value.ToString();
if ( !string.IsNullOrWhiteSpace( key ) && grid.ObjectList.ContainsKey( key ) )
{
return grid.ObjectList[key] as IHasAttributes;
}
}
return null;
}