Question: I am using RadGrid with Nested Hierarchy of Master/Detail Tables. I want to Expand the Master Row when the detail Table inside the row has few rows. I am trying to achieve the same using below code

```
  Private Sub RadGrid_ItemDataBound(ByVal sender As System.Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles dbgView.ItemDataBound
  If <considtion to check if row is expanded>Then
      e.Item.Expanded = True
  End If

```

However even after setting the Expanded flag as True, if I check the value of the state in QuickWatch, it still remains False. Can someone help me understand why state for that specific row is not getting changed? If this is not the right way in changing the state programmatically, can someone let me know the alternate way?

Answer: 
You can do something like this:

```
foreach($a as $k1=>$ar1){
    $text = '';
    foreach($ar1 as $t){
        $text .= "{$t['Name']}, ";
    }
    unset($a[$k1]);
    $a[$k1][0]['Name'] = substr($text,0,-2);
}

var_dump($a);

```

Output:

```
array (size=2)

      0 => 
        array (size=1)
          0 => 
            array (size=1)
              'Name' => string 'kumar, siva' (length=10)
      1 => 
        array (size=1)
          0 => 
            array (size=1)
              'Name' => string 'Arun, Prem' (length=9)

```
This can be solved succinctly with one loop and the implosion of the columnar values in each subarray.

Code ([Demo](https://3v4l.org/MbG6A))

```
$a = [
         [['Name' => 'kumar'],['Name' => 'siva']],
         [['Name' => 'Arun'],['Name' => 'Prem']]
     ];

foreach ($a as $i => $group) {
    $result[$i][] = ['Name' => implode(', ', array_column($group, 'Name'))];
}
var_export($result);

```

Output:

```
array (
  0 => 
  array (
    0 => 
    array (
      'Name' => 'kumar, siva',
    ),
  ),
  1 => 
  array (
    0 => 
    array (
      'Name' => 'Arun, Prem',
    ),
  ),
)

```