title: Setting the Column value of one gridview as the datasource of another gridview
body: <p>I have two gridviews. One gridview datasource is setting through the database. Now I want that when I click on the Row of the first gridview its first column value of the selected row should be set to the second gridview.</p>
  
  <pre><code>    private void masterTab1_ItemSelected(object sender, object selectedValue)
      {
          for (int i = 0; i &lt; 1; i++)
          {
              SerialNumberGrid.Columns.Add("SerialNumber");
              SerialNumberGrid.DataSource = masterTab1.HeaderGrid.SelectedRows[i].Cells[0].Value.ToString();
          }
       }
  </code></pre>
  
  <p>I am doing it this way But its giving me the index out of range exception.</p>
  
  <p><img src="https://i.stack.imgur.com/WRJQ8.png" alt="enter image description here"></p>