0

Any ideas on how to determine the route of the controller from Anchor Tag?

For Example:

Question 1: When Product Name link in screen 1 is clicked.The product details from the controller have to be displayed.How to send the custom action to href in the anchor tag?

Question 2: How to pass the data source from the screen 1 to the controller?

2
  • I presume you have a Model of your items/products? You need to post it up as well as some skeleton code which you are using (I assume you have a foreach loop of some sort) - it'll making trying to help you easier than guessing what you are doing. – jammykam Mar 19 '18 at 22:27
  • You can pass the id of product to description page and get the id in your controller. – Amit Kumar Mar 20 '18 at 2:25
1

You can achieve this by retrieving URL of from Route Name. example could be:

@{ var prodID = 123; } <a href="@Url.RouteUrl("vinc",new { id = prodID })">routinglink</a>

where id will be your product id or Sitecore Item id which you will use in Controller Action method as a parameter.

You will create such route in your custom routing logic reference

Not the answer you're looking for? Browse other questions tagged or ask your own question.