title: print preview based on gridcontrol mainview in c#
body: <p>How can I printpreview in my <code>GridControl</code> DevExpress based on mainview.<br>
  Here is my code:</p>
  
  <pre><code>private void PrintPreview()
  {            
      // Get your currently selected grid row
      var rowHandle = gridView1.FocusedRowHandle;
  
      // Get the value for the given column - convert to the type you're expecting
      var obj = gridView1.GetRowCellValue(rowHandle, "NIK");
  
      try
      {
          if (gridView1.RowCount &lt;=0)
  
          {
              MessageBox.Show("DATA ROW KOSONG", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Error);
          }
          else
          {
              OracleDataAdapter adp = new OracleDataAdapter();
              for (int i = 0; i &lt; gridView1.DataRowCount; i++)
              {                        
                  //connection
                  if (koneksi.koneksi.con.State == ConnectionState.Open)
                  {
                      koneksi.koneksi.con.Close();
                  }
                  koneksi.koneksi.con.Open();
  
                  tambah buka = new tambah();
  
                  OracleCommand cmd = new OracleCommand();
                  cmd.Connection = koneksi.koneksi.con;
                  adp = new OracleDataAdapter(@"SELECT * FROM V_KARYAWAN, KARYAWAN_GAMBAR WHERE V_KARYAWAN.NIK = KARYAWAN_GAMBAR.KARYAWAN_FK AND V_KARYAWAN.NIK = '" + obj + "'", koneksi.koneksi.con);
              }
              DataSet ds = new DataSet();
              adp.Fill(ds, "V_KARYAWAN, KARYAWAN_GAMBAR");
              kartu report = new kartu();
              report.DataSource = ds.Tables[0];
              report.ShowPreview();                                                               
          }
      }
      catch (Exception ex)
      {
          MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
      } 
  }
  </code></pre>
  
  <p>It was difficult for me how to solve this. I cannot take the value from <code>GridControl</code> mainview because mycode just know about <code>FocusedRowHandle</code> in <code>GridControl</code>.</p>
  
  <pre><code>// Get your currently selected grid row
   var rowHandle = gridView1.FocusedRowHandle;
  
  // Get the value for the given column - convert to the type you're expecting
   var obj = gridView1.GetRowCellValue(rowHandle, "NIK");
  </code></pre>
  
  <p>I was using oracle database.</p>