In partial view, template column with anchor tag has wrong url

Hi,

I have a ejs-grid inside a partial razor view. The grid has a template column with the template script as follows

<script id="tempRequisitionStatus" type="text/x-template"> 
    <a rel='nofollow' href="~/Caf/ManageRequisitionForm/Status?requisitionId=${RequisitionId}&instrumentId=${InstrumentId}">Approve/Reject</a>
</script>

However, the rel='nofollow' href is rendered differently depending on where in the folder structure the parent razor page is found, so it is always wrong.

Please advise how to get the relative path in the rel='nofollow' href inside the template.


Thanks

Avinash Tauor



1 Reply

PS Pavithra Subramaniyam Syncfusion Team October 8, 2024 11:06 AM UTC

Hi Avinash,


To achieve your requirement “Setting relative path to the rel='nofollow' href attribute” in ASP.NET Core Grid column template we suggest using the below code example.


 

<div id="tempRequisitionStatus" type="text/x-template">

    <a rel='nofollow' href="~/Caf/ManageRequisitionForm/Status?requisitionId=${RequisitionId}&instrumentId=${InstrumentId}">Approve/Reject</a>

</div>

 


https://ej2.syncfusion.com/aspnetcore/documentation/grid/columns/column-template#render-other-components-in-a-column


Regards,

Pavithra S


Loader.
Up arrow icon