title: c# asp.net table row always going in the same row
body: <p>I have this code</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      TblPrikaz.BorderWidth = 1;
  
      XmlDocument baza = new XmlDocument();
      XmlTextReader reader = new XmlTextReader(Server.MapPath("baza.xml"));
      baza.Load(reader);
      TableRow line = new TableRow();
      TableCell id = new TableCell();
      TableCell ime = new TableCell();
      TableCell prezime = new TableCell();
      TableCell godiste = new TableCell();
  
      id.Text = "ID";
      ime.Text = "Ime";
      prezime.Text = "Prezime";
      godiste.Text = "Godiste";
  
      line.BackColor = Color.Green;
  
      line.Cells.Add(id);
      line.Cells.Add(ime);
      line.Cells.Add(prezime);
      line.Cells.Add(godiste);
  
      TblPrikaz.Rows.Add(line);
  
  
      XmlNodeList popis = baza.GetElementsByTagName("element");
  
      for (int i = 0; i &lt; popis.Count; i++)
      {
  
      if (string.Compare(popis[i].Attributes["ID"].Value.ToString(), "0") == 0) continue;
  
      id.Text = popis[i].Attributes["ID"].Value.ToString();
      ime.Text = popis[i].ChildNodes[0].InnerText;
      prezime.Text = popis[i].ChildNodes[1].InnerText;
      godiste.Text = popis[i].ChildNodes[2].InnerText;
  
      line.Cells.Add(id);
      line.Cells.Add(ime);
      line.Cells.Add(prezime);
      line.Cells.Add(godiste);
  
      TblPrikaz.Rows[i].Cells.Add(id);
      TblPrikaz.Rows[i].Cells.Add(ime);
      TblPrikaz.Rows[i].Cells.Add(prezime);
      TblPrikaz.Rows[i].Cells.Add(godiste);
      }
  }
  </code></pre>
  
  <p>for some reason, the table only shows the loast row read fromthe document and I have no idea why it is doing that.</p>
  
  <p>Anyone have an idea?</p>