title: Copy dropdownlist from another list with DataTextField and DataValueField
body: <p>I create one datalayer method </p>
  
  <pre><code>  public static List&lt;SegmentBL&gt; GetAllSegment(string SortDirection, string SortExpression)
      {
  
          var ds = DBHelper.GetDatabase().ExecuteDataSet("UDS_Select_SegmentMaster");
  
          var val = ds.Tables[0].AsEnumerable().Select(r =&gt; new SegmentBL
          {
              _SegmentId = Convert.ToInt32(r[0].ToString()),
              _SegmentName = r[1].ToString()
          });
          List&lt;SegmentBL&gt; list = val.ToList();
          return list;
      }
  </code></pre>
  
  <p>from that I create one Bussiness logic method</p>
  
  <pre><code>public DropDownList GetAll(string SortDirection, string SortExpression)
      {
          var list = new DropDownList();
          list.DataSource = SegmentDL.GetAllSegment(SortDirection, SortExpression);
          list.DataTextField = "_SegmentName";
          list.DataValueField = "_SegmentID";
          list.DataBind();
          ListItem item = new ListItem();
          item.Text = "--Select--";
          item.Value = "0";
          list.Items.Insert(0, item);
          return list;
      }
  </code></pre>
  
  <p>Finally Presentation Layer Method for filling dropdownlist</p>
  
  <pre><code> private void FillSegment()
      {
          ddlSegment.DataSource = seg.GetAll(General.SortAscending,"SegmentID").Items;
  
          ddlSegment.DataBind();
          ddlSegment.DataTextField = "_SegmentName";
          ddlSegment.DataValueField = "_SegmentID";
      }
  </code></pre>
  
  <p>It's working fine except the DataTextField and DataValueField not assign properly. Currently DataTextField and DataValueField same. What is mistake I did in above code.</p>