title: How to assign anchor tag id to asp-route-id in asp.net core?
body: <p>Below are the anchor tags, which has to call controller action on its click event with dynamic parameters.</p>
  <p>One of the dynamic parameter value is &quot;viewdata&quot; based ie, &quot;asp-route-itemUrl&quot; attribute</p>
  <p>Where as the second dynamic parameter value is based on the corresponding control custom attribute i.e, &quot;asp-route-item-id&quot; attribute.</p>
  <p><strong>Question:</strong><br />
  How to get value of custom attribute &quot;item-id&quot; of  tag &amp; assign to another property &quot;asp-route-itemId' of same  tag?</p>
  <p>asp-route-itemId=&quot;$(this).attr('item-id')&quot; =&gt; <em>not working</em>, 'item-id' attribute value <em>not assigned</em> to &quot;asp-route-itemId&quot; attribute</p>
  <pre><code>  &lt;a item-id=&quot;item1&quot; asp-controller=&quot;Home&quot; asp-action=&quot;Order&quot; asp-route-itemId=&quot;$(this).attr('item-id')&quot; asp-route-itemUrl=&quot;@ViewData[&quot;itemUrl1&quot;]&quot;&gt;Order1&lt;/a&gt;
  
  
    &lt;a item-id=&quot;item2&quot; asp-controller=&quot;Home&quot; asp-action=&quot;Order&quot; asp-route-itemId=&quot;$(this).attr('item-id')&quot; asp-route-itemUrl=&quot;@ViewData[&quot;itemUrl2&quot;]&quot;&gt;Order2&lt;/a&gt;
  </code></pre>