title: Buttons and repeater control
body: <p>I am using ASP.NET, C#, Sql Server 2005 for my project and
  I'm using the repeater control to form a table of users that are a member of a site and a button next to each user so that they can be added to your friends list. I have everything set up except I dont know how to get the specific info of each row after a button click. I mean, </p>
  
  <p>How to send a friend request to a person whose username is displayed besides the button? or
  How to access the the displayed username besides the button so that I can use it for my code?</p>
  
  <p>My Script</p>
  
  <pre><code>&lt;asp:Repeater ID="myrepeater" runat="server"&gt;
          &lt;HeaderTemplate&gt;
              &lt;table style="font: 8pt verdana"&gt;
                  &lt;tr style="background-color:#3C78C3"&gt;
                      &lt;th&gt;Search Result&lt;/th&gt;
                  &lt;/tr&gt;
  
          &lt;/HeaderTemplate&gt;
          &lt;ItemTemplate&gt;
              &lt;tr&gt;
                  &lt;td&gt;
                      &lt;%#DataBinder.Eval(Container,"DataItem.allun")%&gt;
                      &lt;asp:Button ID="Button1" runat="server" Text="Button" /&gt;
                  &lt;/td&gt;
             &lt;/tr&gt;
          &lt;/ItemTemplate&gt;
          &lt;FooterTemplate&gt;
              &lt;/table&gt;
          &lt;/FooterTemplate&gt;
  </code></pre>
  
  <p></p>
  
  <p>Code Behind</p>
  
  <pre><code>protected void btnSearch_Click(object sender, EventArgs e)
  {
      con.Open();
      if (txtSearch.Text != "")
      {
          SqlDataAdapter mycommand = new SqlDataAdapter("select * from WebAdminTable where allun='" + txtSearch.Text + "'", con);
          DataSet ds = new DataSet();
          mycommand.Fill(ds);
          myrepeater.DataSource = ds;
          myrepeater.DataBind();
      }
      else
      {
          //msgbox for entering value
      }
      con.Close();
  }
  
  protected void btnAddToMyFList_Click(object sender, EventArgs e)
  {
        //?    
  }
  </code></pre>