2016-10-29 01:35:15 +08:00
---
2017-07-01 07:47:15 +08:00
title: Adding Search
2016-10-29 01:35:15 +08:00
author: rick-anderson
2017-03-04 05:35:47 +08:00
description: Shows how to add search to simple ASP.NET Core MVC app
2016-10-29 01:35:15 +08:00
manager: wpickett
2018-01-29 23:21:31 +08:00
ms.author: riande
2017-03-04 05:35:47 +08:00
ms.date: 03/07/2017
2017-03-03 08:50:36 +08:00
ms.prod: asp.net-core
2018-01-29 23:21:31 +08:00
ms.technology: aspnet
ms.topic: get-started-article
2016-10-29 01:35:15 +08:00
uid: tutorials/first-mvc-app/search
---
2018-04-05 07:51:35 +08:00
[!INCLUDE [adding-model ](../../includes/mvc-intro/search1.md )]
2016-10-29 01:35:15 +08:00
You can quickly rename the `searchString` parameter to `id` with the **rename** command. Right click on `searchString` ** > Rename**.
2016-12-23 02:03:29 +08:00
![Contextual menu ](search/_static/rename.png )
2016-10-29 01:35:15 +08:00
The rename targets are highlighted.
2016-12-23 02:03:29 +08:00
![Code editor showing the variable highlighted throughout the Index ActionResult method ](search/_static/rename2.png )
2016-10-29 01:35:15 +08:00
Change the parameter to `id` and all occurrences of `searchString` change to `id` .
2016-12-23 02:03:29 +08:00
![Code editor showing the variable has been changed to id ](search/_static/rename3.png )
2016-10-29 01:35:15 +08:00
2018-04-05 07:51:35 +08:00
[!INCLUDE [adding-model ](../../includes/mvc-intro/search2.md )]
2016-10-29 01:35:15 +08:00
2017-04-10 08:52:07 +08:00
Notice how intelliSense helps us update the markup.
2016-10-29 01:35:15 +08:00
2016-12-23 02:03:29 +08:00
![Intellisense contextual menu with method selected in the list of attributes for the form element ](search/_static/int_m.png )
2016-10-29 01:35:15 +08:00
2016-12-23 02:03:29 +08:00
![Intellisense contextual menu with get selected in the list of method attribute values ](search/_static/int_get.png )
2016-10-29 01:35:15 +08:00
Notice the distinctive font in the `<form>` tag. That distinctive font indicates the tag is supported by [Tag Helpers ](../../mvc/views/tag-helpers/intro.md ).
2016-12-23 02:03:29 +08:00
![form tag with purple text ](search/_static/th_font.png )
2016-10-29 01:35:15 +08:00
2018-04-05 07:51:35 +08:00
[!INCLUDE [adding-model ](../../includes/mvc-intro/search3.md )]
2016-10-29 01:35:15 +08:00
2018-04-05 07:51:35 +08:00
> [!div class="step-by-step"]
> [Previous](controller-methods-views.md)
> [Next](new-field.md)