I have an asp.net core MVC project I am creating custom scaffolding template files
I am following this answer to add custom scaffolding template pages
on Details
page I want o add link to Listing
, Edit
and Delete
page as below
@using System.Linq
@@model @Model.ViewDataTypeName
@: <div class="card-body py-2">
@: <a asp-action="Delete" asp-route-id="@@Model.pkName" class="float-right btn-floating btn-sm btn-danger m-0" title="Delete @Model.ViewDataTypeShortName Record"><i class="fa fa-trash"></i></a>
@: <a asp-action="Edit" asp-route-id="@@Model.pkName" class="float-right btn-floating btn-sm btn-warning m-0 mr-2" title="Edit @Model.ViewDataTypeShortName Record"><i class="fa fa-edit"></i></a>
@: <a asp-action="Index" class="float-right btn-floating btn-sm btn-info m-0 mr-2" title="Back to @Model.ViewDataTypeShortName listing page"><i class="fa fa-arrow-left"></i></a>
@: <h4 class="mb-2 mb-sm-0 pt-1">@Model.ViewDataTypeShortName Details</h4>
@: </div>
Notice asp-route-id="@@Model.pkName"
in above example, Actualloy here I need to put primaryKey field name dynamically, @@Model.pkName
is not a valid property but I just wanted to show something here.
@Model.ViewName
` while I replaced with content displayed in `div.card-body`, in above code `@@model.pkName` is throwing error, I want it to display `model.id`,`model.recID`,`model.whatever_is_primarykey_field_name` – alamnaryab Jun 16 '22 at 07:14