Anchor tag helper in Asp.Net core allows you to specify parameter values in the tag that builds complete URL for the action. For most of the cases, specifying asp-controller and asp-action attributes are the ones you will need to construct URL that will be used to populate href attribute of anchor tag. The example could look like below.
<a asp-controller="Organization" asp-action="DeleteBranch">Delete</a>
Above tag will build URL as "/organization/deletebranch. Sometime you have to pass additional parameters in URL for actions. E.g. if I want to edit some model, then I may have to pass identifier value in URL or route. To facilitate that will use asp-route-{parametername} attribute and set the value in that attribute.
<a asp-controller="Organization" asp-action="EditBranch" asp-route-id="@branch.Id">Edit</a>
In my case above tag will generate URL as "/organization/editbranch/1". Then controller can extract value of "id" and do the job.
How to specify link parameters in Anchor Tags
How to supply startup parameters to Silverlight applications using InitParams
How to plan CCSP Exam preparation
Develop a MongoDB pipeline to transform data into time buckets
Alert and Confirm pop up using BootBox in AngularJS
AngularJS Grouped Bar Chart and Line Chart using D3
How to lock and unlock account in Asp.Net Identity provider
2025 © Byteblocks, ALL Rights Reserved. Privacy Policy | Terms of Use