Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi i need some help I have implemeted the search from https://codeshare.co.uk/blog/how-to-search-by-document-type-and-property-in-umbraco/
I want to pass the to the /search?query=something take and the query value from the Request.QueryString and pass it to the RenderForm action.
Can someone help me Thanks in advance Christina
Hi Christina
In the view you can add something like this
@{ string searchTerm = Request.QueryString["query"]; }
Then when you call the render action you can pass it in like this
@{ Html.RenderAction("RenderSearchForm", "Search", new { searchTerm = searchTerm }); }
And in the action you can pick up the value in the constructor like this
[HttpGet] public ActionResult RenderSearchForm(string searchTerm) { //code in here }
I hope that helps.
Paul
Although just having query in the Action should work without the rest of it.
[HttpGet] public ActionResult RenderSearchForm(string query) { //code in here }
Hi Paul Many thanks I really appreciate your videos. Another question If i want the searchform in the header what should i do /Christina
You're welcome.
You could just add a simple form like this in the header.
<form action="/search/" method="GET"> <input type="text" placeholder="Search..." name="query"> <button>Search</button> </form>
Kind regards
Many Thanks
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Help with querystring
Hi i need some help I have implemeted the search from https://codeshare.co.uk/blog/how-to-search-by-document-type-and-property-in-umbraco/
I want to pass the to the /search?query=something take and the query value from the Request.QueryString and pass it to the RenderForm action.
Can someone help me Thanks in advance Christina
Hi Christina
In the view you can add something like this
Then when you call the render action you can pass it in like this
And in the action you can pick up the value in the constructor like this
I hope that helps.
Paul
Although just having query in the Action should work without the rest of it.
Hi Paul Many thanks I really appreciate your videos. Another question If i want the searchform in the header what should i do /Christina
You're welcome.
You could just add a simple form like this in the header.
Kind regards
Paul
Many Thanks
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.