title: Passing values from view to controller
body: <p>I have an issue where I read the value from textbox and pass its value through URL from a jqgrid to controller. It works if the value of the textbox is simple, but if it ends with a space or any special character it doesn't appear to be passed any idea's on why this would happen? I have the sample here that I am using, the value #txtSearch is not being passed to controller as id under the mentioned cases.</p>
  
  <pre><code>      &lt;script type="text/javascript"&gt;
  
      $(function () {
          jQuery("#list").jqGridCustom({
              url: 'JSONData/SearchGUIString/' + $('#txtSearch').val(),                
           Model.Search }) %&gt;',
              datatype: 'json',
              colNames: [ 'Results', 'Reference ID', 'Location'],
              colModel: [
                  { name: 'Results', index: 'results', width: 40, align: 'left', sortable: false },
                  { name: 'Reference ID', edittype: 'select', formatter: 'showlink', formatoptions: { baseLinkUrl: '&lt;%= Url.Action("EditSearchResults", new {controller = "Search"}) %&gt;', addParam: '&amp;action=edit' }, width: 40, align: 'left', sortable: false },
                  { name: 'Location', index: 'fileLocation', width: 200, align: 'left', sortable: false }, ],
              pager: $('#pager'),
              autowidth: true,
              rowNum: 20,
              height: "345",
              rowList: [5, 10, 20, 50],
              recordtext: "View Records {0} - {1} of {2}",
              emptyrecords: "No records to view",
              loadtext: "Loading...",
              pgtext: "Page {0} of {1}",
              sortname: 'Results',
              sortorder: "desc",
              viewrecords: true,
              scroll: false,
              loadonce: false,
              caption: 'Search Results'
          });
      });        
       &lt;/script&gt;
      &lt;h2&gt;    
          &lt;% using (Html.BeginForm())
              { %&gt;          
               &lt;label for="txtSearch"&gt; Search: &lt;/label&gt;
               &lt;%: Html.TextBox("txtSearch", Model.Search) %&gt;
               &lt;% } %&gt;
      &lt;/h2&gt;
  </code></pre>