2

0I want to insert the output of an action into a view. The problem is that the action requires some info in the querystring. Is there a way to include the querystring params in Action?

Example:

@Html.Action("Get","Contacts")

To get the proper result back, I need to pass ?pagenum=1 to the action.

@Html.Action("Get?pagenum=1","Contacts")  unfortunately doesn't work
0

1 Answer 1

5
@Html.Action("YourActionName", "YourControllerName", new { pagenum = 1 })

Use the overload of Action() to define route values.

MSDN Reference

Is your Action Method really named Get()? If so, and your controller name is Contacts, your modified code would need to be:

@Html.Action("Get", "Contacts", new { pagenum = 1 })
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.