How to access variable from other view page on yii2?

How to access variable ($imodel->grade) in tampil.php page and then subsequently put on the page view.php.

Here is The code of actionIndex:




public function actionIndex()

    {

        $imodel = new Grade();


      if($imodel->load(Yii::$app->request->post()))

      { 

        $imodel->load(Yii::$app->request->post());

        $imodel->grade;


           $query = Nilaiharian::find(); //select nis, $grade, nama from nilaiharian

           $dataProvider = new ActiveDataProvider(['query' => $query,]);

           

           return $this->render('tampil', ['imodel' => $imodel, 'dataProvider' => $dataProvider,] );

      } 

      else

      {

        return $this->render('index', ['imodel' => $imodel, ] );   

      }

    }



And this is a code of tampil.php




<?php 

      

        echo "Nilai untuk ".$imodel->grade; 

        echo "<br>";

        echo GridView::widget([

        'dataProvider' => $dataProvider,

        'columns' => [

            ['class' => 'yii\grid\SerialColumn'],

            'nis',

            $imodel->grade,

            'nama',

            ['class' => 'yii\grid\ActionColumn',

                        'template'  => '{view}{update}{delete}',

                        'buttons' => [

                                'view' => function ($url, $model) {

                                        return Html::a('<i class="glyphicon glyphicon-eye-open"></i>', 

                                          $url, ['title' => Yii::t('app', 'Show'), 'name'=>'view', 'value'=>'view', 'style' => 'margin-right:10px;', ]);

                                },

                                'update' => function ($url, $model) {

                                        return Html::a('<i class="glyphicon glyphicon-pencil"></i>', 

                                          $url, ['title' => Yii::t('app', 'Edit'), 'name'=>'update', 'style' => 'margin-right:10px;', ]);

                                },

                                'delete' => function ($url, $model) {

                                        return Html::a('<i class="glyphicon glyphicon-trash"></i>', 

                                          $url, ['title' => Yii::t('app', 'Delete'), 'name'=>'delete', 'data-confirm'=>'Are you sure you want to delete this record?']);

                                }

                        ]

                ],

         ], 


         ]); 

    ?>