you can dynamically add or change attributes [i mean attributes reported by PropertyDescriptor (which is obtained by TypeDescriptior.GetProperties) not the ones queried by reflection]. ASP.Net uses TypeDescriptor approach not reflection but in a web environment you cant be sure noone is requesting a page by the time you temporary make modifications. attributes are global accross your app. so only option is editing and adding conditional statements to templates.
Dynamic / Conditional ScaffoldColumn or ReadOnly attribute - is it possible?
-
04-06-2022 - |
Question
I understand that .NET attribute values do not change during run-time by design.
However, is there a way I could roll my own dynamic ScaffoldColumn or ReadOnly attribute to use in a Dynamic Data project? So that the value is conditionally true or false, depending on say the URL of the request?
I don't wish to rewrite the templates or create "custom pages" - however small modifications to the templates is OK.
I'll accept no as an answer.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow