title: dynamic columns disappears after postback
body: <p>I have a <code>GridView</code> with some <code>BoundFields</code> and two <code>TemplateFields</code>. In these two <code>TemplateFields</code>, I dynamically create <code>UserControls</code> containing a <code>DropDownList</code> and a <code>TextBox</code>, which users can modify.</p>
  
  <p>When I try to get the values of the controls after a <code>PostBack</code>, the values in <code>BoundFields</code> are still there but my dynamic controls disappears. I can create them again but it won't get the user's values... How can I get these values before they're lost?</p>
  
  <p>Here's some of my code:</p>
  
  <p><strong>In the <code>RowDataBound</code> event:</strong></p>
  
  <pre><code>Select Case type
      Case "BooleanBis"
          e.Row.Cells(2).Controls.Clear()
          Dim list1 As BooleanBisList = New BooleanBisList(avant, False)
          e.Row.Cells(2).Controls.Add(list1)
  
          e.Row.Cells(4).Controls.Clear()
          Dim list2 As BooleanBisList = New BooleanBisList(apres, True)
          e.Row.Cells(4).Controls.Add(list2)
      Case "Boolean"
          e.Row.Cells(2).Controls.Clear()
          Dim list3 As BooleanList = New BooleanList(avant, False)
          e.Row.Cells(2).Controls.Add(list3)
  
          e.Row.Cells(4).Controls.Clear()
          Dim list4 As BooleanList = New BooleanList(apres, True)
          e.Row.Cells(4).Controls.Add(list4)
  End Select
  </code></pre>
  
  <p>In my button click event, I try to get the user control : </p>
  
  <pre><code>Case "String"
      temp.ChampValeurApres = DirectCast(Tableau1.Rows(i).Cells(selectedColumn).Controls(1), TextBox).Text
  </code></pre>
  
  <p>but i get the error that it doesn't exist.</p>