title: How to bind a List<string> to GridView in ASP.NET?
body: <p>I am hitting an API and storing the returned parsed data to a <code>List</code>. Currently I am displaying the data in the <code>ListView</code>.
  I am not able display the same list in a <code>GridView</code>. Can anyone guide me how to do it?</p>
  
  <p>This is my aspx.cs code:</p>
  
  <pre><code>    protected void Page_Load(object sender, EventArgs e)
      {
          ComodityList obj_comodity_in = (ComodityList)Session["comodity_list"];
          Label1.Text = obj_comodity_in.status_code;
          Label2.Text = obj_comodity_in.count.ToString();
  
          //ComodityList obj_comodity_in = (ComodityList)Session["comodity_list"];
  
          List&lt;String&gt; commodity_names = null;
          getComodityNames(out commodity_names, obj_comodity_in);
          ListView1.DataSource = commodity_names;
          ListView1.DataBind();   
      }
      private void getComodityNames(out List&lt;String&gt; commodity_names, ComodityList cl)
      {
          commodity_names = new List&lt;string&gt;();
          foreach (Commodity c in cl.data)
          {
              commodity_names.Add(c.commodity);
              commodity_names.Add(c.state);
              commodity_names.Add(c.market);
              commodity_names.Add(c.Maximum_Price.ToString());
              commodity_names.Add(c.Minimum_Price.ToString());
              commodity_names.Add(c.Modal_Price.ToString());
              commodity_names.Add(c.origin);
              commodity_names.Add(c.unit);
              commodity_names.Add(c.variety);
  
  
          }
      }
  </code></pre>