title: Converting a SharePoint SPListItem into a Drop down ListItem
body: <p>I am trying to convert a SharePoint <code>SPListItem</code> into a <code>ListItem</code> to put into a Drop Down List. My problem is that the data in the SharePoint list is stored like this:</p>
  <blockquote>
  <p>;#Daylight;#</p>
  <p>;#Design;#Employee Engagement;#</p>
  </blockquote>
  <p>But Obviously this does not work for me. I need to remove the ;# symbols which should be as simple as <code>String.Replace</code> but where I am running into some problems is what should I do for list items that contain multiple selections (my second example above). The ultimate goal here is to generate a drop down list (that does not contain duplicates) of all the items in the SharePoint List. Any ideas?</p>
  <pre><code>        using (SPSite site = new SPSite(SPContext.Current.Web.Url.ToString()))
          using (SPWeb oWebsiteRoot = site.OpenWeb())
          {
              SPList oList = oWebsiteRoot.Lists[&quot;WplData&quot;];
              SPListItemCollection items = null;
              SPQuery query = new SPQuery();
              query.Query = &quot;&lt;Where&gt;&lt;IsNotNull&gt;&lt;FieldRef Name='Topic' /&gt;&lt;/IsNotNull&gt;&quot; +
                  &quot;&lt;/Where&gt;&lt;OrderBy&gt;&lt;FieldRef Name='Topic' Ascending='True' /&gt;&lt;/OrderBy&gt;&quot;;
              items = oList.GetItems(query);
              DataTable tmpTable = new System.Data.DataTable();
              tmpTable = items.GetDataTable();
              DataView view = new DataView(tmpTable);
              String[] columns = { &quot;Topic&quot; };
              DataTable table = view.ToTable(true, columns);
              foreach (DataRow row in table.Rows)
              {
                  foreach (var item in row.ItemArray)
                  {
                      ListItem listItem = new ListItem();
                      listItem.Value = item.ToString();
                      listItem.Text = item.ToString();
                      TopicDropDownList.Items.Add(listItem);
                  }
              }
         }
  </code></pre>