Can you post the method/controller that you're calling in your template?
My above answer should get you half way there, if you then need to pass it through to the view, you can do so in the method in the controller. Be easier to see that controller first however to give you proper advice.
Passing parameters
Hi folks, looking for some help here;
I have a hyperlink that a user can click on; the hyperlink will render a page.
I would like to pass a parameter to the template of that page.
Basically I’m trying to pass a parameter from the hyperlink to the template,
which will then pass the parameter to action within the controller.
Hyperlink to page.
Template of page
Hi Tom,
I tend to use @Url.Action helper.
See the following article:
http://techfunda.com/howto/251/get-url-of-action-method
Hopefully this will point you in the right direction.
Craig
Thanks Craig, but it doesn't show you how to pass a parameter with the Umbraco syntax
Hi Tom,
Have you tried to have a look at this documentation
https://our.umbraco.org/documentation/Reference/Templating/Mvc/child-actions#RenderingaChildAction
Hope this helps,
/Dennis
OK this what I have so far, still no parameter being passed to the render action
Hyperlink
Template
Hi Tom,
Is it´s something like this that you are trying to do
Then the final url will be http://www.yourdomain.com/page?p=1040 where 1040 is the id of the page that you are viewing in the browser.
Hope this helps,
/Dennis
Hi Tom,
You can use the Request object to access the querystring values in your Action.
E.g.
Request.QueryString["NameOfYourQueryString"]
You can then use those values as you see fit in your Action logic.
Thanks
Craig
How do I pass the parameter EditStatus from the href to the render action,
Try
Depending on the Location of your Action you might have to use one of the many overloads for
@Html.ActionLink
and pass in the ControllerName.E.g. http://some-site.com/Controllerame/ActionName?EditStatus=1
Craig
Thanks Craig, but I'm not trying to pass to the Controller, I'm trying to pass the parameter to the RenderAction
Hi Tom,
You'd be passing it through to the method (i.e. the action) in that controller.
So if you put together answers from both Dennis and Craig, you'd get something like:
And:
Action
will be in a controller and would haveeditStatus
as a parameter. Does that achieve what you're trying to do?I want to achieve the same thing i.e. passing the parameter from anchor to the template (or you can say Umbraco page that calls the template).
Plz update if anyone has solved this.
thanks
Hi Sahar,
Can you post the method/controller that you're calling in your template?
My above answer should get you half way there, if you then need to pass it through to the view, you can do so in the method in the controller. Be easier to see that controller first however to give you proper advice.
is working on a reply...