title: how to insert data in to grid view using asp.net without database
body: <p>I have this code in my code behind.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  
  public partial class _Default : System.Web.UI.Page
  {
      protected void Page_Load(object sender, EventArgs e)
      {
  
      }
  
      public class fields
      {
          public string firstname { get; set; }
          public string middlename { get; set; }
          public string lastname { get; set; }
          public string phonenumber { get; set; }
  
      }
      protected void Button1_Click(object sender, EventArgs e)
      {
          List&lt;fields&gt; data = new List&lt;fields&gt;();
  
          string fn = TextBox1.Text;
          string mn = TextBox3.Text;
          string ln = TextBox2.Text;
          string pn = TextBox4.Text;
  
          fields s = new fields();
          s.firstname = TextBox1.Text;
          s.middlename = TextBox3.Text;
          s.lastname = TextBox2.Text;
          s.phonenumber = TextBox4.Text;
  
          data.Add(s);
  
          GridView1.DataSource = data;
          GridView1.DataBind();
  
  
  
      }
  }
  </code></pre>
  
  <p>I have four textboxes in my view. I am trying to show in the grid those data when I click submit button my page. But I am not able to show the data in the grid.</p>
  
  <p>can any body help me out.</p>