On Row Command for GridView control
<p>I have a GridView control in my C# web application.  In my gridview I have a ButtonField called Select, <code>ID="btnSelect"</code>.  Basically in my GridView control, I have a clients firstname, last name, addr, and phone number, and for the for the corresponding information I have textboxes.  When I hit/ fire the select button in the gridview, I want the clients name to go into the text box, and I have done that successfully, however in my application you can select up to 6 clients.  Is there a better way than how I am doing this?  Code is below:</p>

<pre><code> void GridView1_RowCommand(Object sender, GridViewCommandEventArgs e)
 {
  int index = Convert.ToInt32(e.CommandArgument);
  GridViewRow row = GridView1.Rows[index];


  if(string.IsNullOrEmpty(txtName1.Text) &amp;&amp; string.IsNullOrEmpty(txtLName1.Text) &amp;&amp;
     string.IsNullOrEmpty(txtAddr1.Text) &amp;&amp; string.IsNullOrEmpty(txtPhone1.Text))
    {
      txtName1.Text=Server.HtmlDecode(row.Cells[1].Text);
      txtLName1.Text=Server.HtmlDecode(row.Cells[2].Text);
      txtAddr1.Text=Server.HtmlDecode(row.Cells[3].Text);
      txtPhone1.Text=Server.HtmlDecode(row.Cells[4].Text);

    }
  //If I hit another select button then this will load the sencond set of txtboxes
    if(string.IsNullOrEmpty(txtName2.Text) &amp;&amp; string.IsNullOrEmpty(txtLName2.Text) &amp;&amp;
     string.IsNullOrEmpty(txtAddr2.Text) &amp;&amp; string.IsNullOrEmpty(txtPhone2.Text))
    {
      txtName2.Text=Server.HtmlDecode(row.Cells[1].Text);
      txtLName2.Text=Server.HtmlDecode(row.Cells[2].Text);
      txtAddr2.Text=Server.HtmlDecode(row.Cells[3].Text);
      txtPhone2.Text=Server.HtmlDecode(row.Cells[4].Text);

    }
 //The thrid time will load the third button and so on until I fill each txtbox if I choose.
}
</code></pre>

<p>Is there a better way to code this to where if each time I hit the Select button in the row Command, I will not have to put all those complicated if statements there?  Is there like a foreach loop that can handle this  Any guidance would be greatly appreciated!</p>
