Relative Content

Tag Archive for asp.net.netasp.net-corerazorrazor-pages

Using asp-validation-for in foreach, doesn’t recognize fields and gives error

I’m using Razor pages for my ASP.NET project. After cloning the repository, it started giving one specific build error :
Error (active)
CS1061 List< CaseFileStatus > does not contain a definition for ‘CreatedTime_’ and no accessible extension method ‘CreatedTime_’ accepting a first argument of type ‘List< CaseFileStatus >’ could be found (are you missing a using directive or an assembly reference?)

Here is the codeblock which gives the error :

How to pass js function argument to inline c# in cshtml?

Preface:
I have a static formatting function in my backend, which takes an int Id and returns string SerialNumber. I want to keep it in on place.
In one of the Views – I am showing a column of Serial Number. This column is sortable (by sql query), so the content of the column should be Id value, so I am modifying the displayed value with js to convert Id to Serial.