I wanted to add the sorting and filtering to my Application. (I want to organize some events) When I know search for an event with has an 'a' in it and than want to sort the results, all results are shown again and sorted. 

I know, that I have to pass the searchString as a Routeparameter for the Actionlink. But how can I do this?

I found one solution with Request.Querystring but it hadn't work. 
Someone told me to do it with JavaScript, so I tried to write a function but it didn't work either.
Can anybody help me? 

Excerpts from my code:

Actionlink:

```
    <h1>events</h1>
    @using (Html.BeginForm())
    {
    <p>
        <lable>events:</lable>
        @Html.TextBox("SearchString")
        <input type="submit" value="Search" />
    </p>
    <table class="table">
        <thead>
            <tr>
                <th>
                    @Html.ActionLink("Titel", "Index", new { sortOrder = ViewBag.NameSortParm}, new { id = action})             
                </th>
            </tr>
        </thead>
    </table>

```

JavaScript-Function:

```
<script>
    $(function () {
        $('#action').click(function () {
            var s = $('#SearchString').val();
            this.href = this.href + '?searchString=' + encodeURIComponent(searchString);
        });
    });
</script >

```

Controller:

```
public async Task<IActionResult> Index(string sortOrder, string searchString)
        {
            ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "titel_desc" : "";

            var vs = from t in _context.Events select t;

            if (!String.IsNullOrEmpty(searchString))
            {
                vs = vs.Where(s => s.Titel.Contains(searchString));
            }

            switch (sortOrder)
            {
                case "titel_desc":
                    vs = vs.OrderByDescending(m => m.Titel);
                    break;
                default:
                    vs = vs.OrderBy(m => m.Titel);
                    break;
            }
            return View(await vs.ToListAsync());
        }

```