title: Getting Cannot implicitly convert int to string when creating a combobox from from database
body: <p>I'm trying to populate a combobox in a creation view inside MVC 3. This is what i've done so far:</p>
  
  <pre><code>    public ActionResult Create()
      {
          var db = new ErrorReportingSystemContext();
          IEnumerable&lt;SelectListItem&gt; items = db.Locations
            .Select(c =&gt; new SelectListItem
            {
                Value =c.id,
                Text = c.location_name
            });
          ViewBag.locations = items;
          return View();
      } 
  </code></pre>
  
  <p>However when i try to run it it gives a compilation error:</p>
  
  <p><code>Cannot implicitly convert int to string</code></p>
  
  <p>In <a href="https://stackoverflow.com/questions/1066760/problem-with-converting-int-to-string-in-linq-to-entities">this</a> post i read that doing</p>
  
  <pre><code>Value = SqlFunctions.StringConvert((double)c.ContactId)
  </code></pre>
  
  <p>would fix the problem however when i try to do that i get the following error:</p>
  
  <p><code>the name 'SqlFunctions' does not exist in the current context</code> </p>
  
  <p>What i'm i doing wrong?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>doing <code>Value = c.id.ToString()</code> gives the error:</p>
  
  <p><code>LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.</code></p>