I am working on a module at this moment using which we are planning to generate dynamic text on the pages accroing to stored values in the database. So that would be something like Key-value pair in the database.
In this case, I have created a table in the back which will hold all the Key-value pairs in the back. All the Aspx pages would have only keys contained at the design time and at the run time it would be replaced by values. according to what is defined in the database.
But here, I am wondering how would I be able to adentify all the keys on the page? I am not sure what is the industry standard to achieve something like this?
I mean I can use some patter like [key]( with two square brackets) or may be a label control?
Since you’ll only need the keys for some backend logic (apparently); you can put all the keys on a hidden element and access it from code behind like this:
On code behind you can set/read the values by simply doing:
Now, be aware that this is not safe; nothing is to prevent the user from changing the key values on the client side before submitting the form. It’s up to you to decide whether this is a concern or not.