# C1.Win.FlexGrid.IC1FlexGridRowDetail.Setup

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_FlexGrid_IC1FlexGridRowDetail_Setup_" data-uid="C1.Win.FlexGrid.IC1FlexGridRowDetail.Setup*">Setup Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_FlexGrid_IC1FlexGridRowDetail_Setup_" data-uid="C1.Win.FlexGrid.IC1FlexGridRowDetail.Setup*"></a>
<h4 id="C1_Win_FlexGrid_IC1FlexGridRowDetail_Setup_C1_Win_FlexGrid_C1FlexGrid_System_Int32_" data-uid="C1.Win.FlexGrid.IC1FlexGridRowDetail.Setup(C1.Win.FlexGrid.C1FlexGrid,System.Int32)">Setup(C1FlexGrid, int)</h4>
<div class="markdown level1 summary"><p>Used to setup control before showing of it.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">void Setup(C1FlexGrid parentGrid, int rowIndex)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Sub Setup(parentGrid As C1FlexGrid, rowIndex As Integer)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="C1.Win.FlexGrid.C1FlexGrid.html">C1FlexGrid</a></td>
      <td><span class="parametername">parentGrid</span></td>
      <td><p>FlexGrid which displays detail control.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">rowIndex</span></td>
      <td><p>Index of parent detail row.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_FlexGrid_IC1FlexGridRowDetail_Setup_C1_Win_FlexGrid_C1FlexGrid_System_Int32__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This method can be used to setup data binding or other properties of the detail control.</p>
<p>The parameters of this method contain instance of parent C1FlexGrid and row index. 
The row index can be used to determine the right index of data object in grid data source.</p>
</div>
<h5 id="C1_Win_FlexGrid_IC1FlexGridRowDetail_Setup_C1_Win_FlexGrid_C1FlexGrid_System_Int32__examples">Examples</h5>
<p>The code below shows the basic implementation of Setup method for detail control derived from C1Label:</p>
<pre><code class="lang-csharp">void IC1FlexGridRowDetail.Setup(C1FlexGrid parentGrid, int rowIndex) 
{ 
    // initialize BindingSource object from parent grid's data source
    var bs = new BindingSource(parentGrid.DataSource as DataSet, "Employees"); 

    // retrieve and assign right position of data object in the parent grid's data source
    bs.Position = parentGrid.Rows[rowIndex].DataIndex; 

    // assign corresponding data field
    DataField = "Notes"; 

    // assign setup BindingSource object as data source
    DataSource = bs; 
}</code></pre>

</div>
