I have a bootstrap navbar at the top of my page main page and inside it is a text input. I want it hidden until a search is performed and the user sees the results in the results
controller .
This is inside my bootstrap navbar.
<input type="text" class="form-control" placeholder="Search">
For example:
Hidden: www.example.com/home/index
Visible: www.example.com/results
In this case, you actually don't need to pass any specific information from the controller to the shared layout.
The shared layout can inspect the current route and the behave accordingly.
@if (ViewContext.RouteData.Values["Controller"].ToString() == "results")
{
<input type="text" class="form-control" placeholder="Search">
}
More Info:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With