title: How can i access value of datalist controls which generated at run time in ASP.NET
body: <p>The datalist generated code at runtime: how can I access values of the datalist element after page postback?</p>
  
  <pre><code>void CreateDATELIST(Control container)
  {   
      var st = settings.CustomPossition();
      foreach (var item in settings.CustomPossition())
      {  
          DataTable dt = new DataTable();
          dt.Columns.Add("Name");
          dt.Columns.Add("Possition");
          dt.Columns.Add("Production");
          dt.Columns.Add("dpo");
          dt.Columns.Add("WorkDay");
          DataRow dr;
          foreach (var users in item.Users)
          {
              dr = dt.NewRow();
              dr["Name"] = users.Name;
              dr["Possition"] = users.Position.Name;
              dr["Production"] = users.DailyGoalAmount * (double)(users.WorkDays / 12;
              dr["dpo"] = users.DailyGoalAmount;
              dr["WorkDay"] = users.WorkDays;
              dt.Rows.Add(dr);
              dt.AcceptChanges();
          }
          DataList dataList = new DataList();
          dataList.ItemTemplate = Page.LoadTemplate("Commnets.ascx");
          container.Controls.Add(dataList);
  
          dataList.DataSource = dt;
          dataList.DataBind();
      }
  }
  </code></pre>