title: The input string was not in the correct format
body: <p>i'm getting an error in this piece of code with asp.net mvc 4 "input string was not in a correct format" i know why i get this error because im making a search filter by Marca (Brand, im making it in spanish), the dropdownlist where the brands are in a table are in string value, but the row in the Items Table where they are related is an int value. The search results http post tries to do it with string values and i get the error, if i type manually in the url the int id of the brand i want to search the query passes. Here is an example of my code and sorry for my bad english.</p>
  
  <pre><code>public ActionResult Index(string marcas, string search_query)
      {
  var MarcaLst = new List&lt;string&gt;();
  
  var MarcaQry = from d in db.Marcas // table Brand
                 orderby d.Marca1 // string row of the table Brand
                 select d.Marca1;
  MarcaLst.AddRange(MarcaQry.Distinct());
  ViewBag.marcas = new SelectList(MarcaLst);
  
  var marca = from m in db.Marcas
              select m;
  
  if (!String.IsNullOrEmpty(search_query))
  {
      descripcion = descripcion.Where(s =&gt; s.Descripcion.ToUpper().Contains(search_query.ToUpper()));
  }
  
  if (string.IsNullOrEmpty(marcas))
      return View(descripcion.ToList());
  else
  {
      int marcasint = Convert.ToInt32(marcas); // I get the error here from a work around to make the page load
      return View(descripcion.Where(x =&gt; x.MarcaID == marcasint)); //MarcaID is the int value of the Items table for the Brand
  }
  }
  </code></pre>
  
  <blockquote>
    <blockquote>
      <p>url/articulos?search_query=a&amp;marcas=BSN //Error</p>
      
      <p>url/articulos?search_query=a&amp;marcas=1 //Pass</p>
    </blockquote>
  </blockquote>