title: Trying to create a dropdown list and textbox, setting list item as data and text box as value - asp.net mvc 4
body: <p>I am trying to create a search form that searches based on Server Name or Printer Name. Here is the snippet from my controller:</p>
  
  <pre><code>List&lt;SelectListItem&gt; items = new List&lt;SelectListItem&gt;();
          items.Add(new SelectListItem { Text = "Server Name", Value = "ServerName" });
          items.Add(new SelectListItem { Text = "Printer Name", Value = "PrinterName" });
  
          ViewData["newlist"] = items;
  </code></pre>
  
  <p>Here is my view (which I know is wrong because it doesn't work):</p>
  
  <pre><code> @using (Html.BeginForm("search", "PrintQueues", FormMethod.Get))
  {
      &lt;fieldset&gt;
          &lt;legend&gt;
              Search
          &lt;/legend&gt;
  
      @Html.DropDownList("newlist",ViewData["newlist"] as SelectList)
      @Html.TextBox("newlist")
      &lt;p&gt; 
         &lt;input type="submit" value="Submit" /&gt;
     &lt;/p&gt;
      &lt;/fieldset&gt; 
  }
  </code></pre>
  
  <p>If I pick "Server Name" and put in a value (such as "myservernaem" into the textbox, I want the url to show:</p>
  
  <pre><code>/search?ServerName=myservername
  </code></pre>
  
  <p>I'm pretty sure both my controller and view are incorrect.</p>