title: How to manage a Two-Way databinding in an ASP.NET web control?
body: <p>I have a question about how to perform a two-way databinding in an ASP.NET control (in this example a repeater control). The technology is Web Forms. My question is, where can I read the user's data after a postback? (See MyButton_Click below).</p>
  
  <p>Markup:</p>
  
  <pre><code>&lt;asp:Repeater runat="server" ID="MyRepeater"&gt;
      &lt;ItemTemplate&gt;
          &lt;asp:Label runat="server"&gt;Name:&amp;nbsp;&lt;/asp:Label&gt;&lt;asp:TextBox ID="MyTextBox" runat="server" Text='&lt;%#Bind("Name") %&gt;'&gt;&lt;/asp:TextBox&gt;&lt;br/&gt;
      &lt;/ItemTemplate&gt;
  &lt;/asp:Repeater&gt;
  
  &lt;asp:Button runat="server" ID="MyButton" Text="Hit me" OnClick="MyButton_Click" /&gt;
  </code></pre>
  
  <p>Interface:</p>
  
  <p><img src="https://i49.photobucket.com/albums/f264/xdannil/interface-1.jpg" alt="interface.jpg"></p>
  
  <p>Code behind:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      MyRepeater.DataSource = (
          from d in Data.GetData()
          select new
                  {
                      Name = d
                  }).ToList();
  
      MyRepeater.DataBind();
  }
  
  protected void MyButton_Click(object sender, EventArgs e)
  {
      // Ok now, where is the user's changed data...?
  }
  </code></pre>