Here I will brief you about the method which will give you a Configuration value depending upon the key passed. Of course, the key and value pair will be residing in your SharePoint list.
Being a good developer you should make your application as configurable as possible to avoid last minute rush to small changes and hence resulting in another deployment of a solution.
E.g. Consider a case where you have marked your Custom Top Navigation code to have 6 nodes(Hard coded value / taken from constants ); But due to some requirement changes you need to make it 8 nodes now.How you will do it ? Again a Code Change ? If you do; this will require another solution deployment.
Instead of that; identify these kind of parameters in your custom application and try and make those as configurable as possible which may lead to changes in future.
For this to have create a new list Named Configuration Settings at root site collection (of course you can have any name), with 3 site columns :
Being a good developer you should make your application as configurable as possible to avoid last minute rush to small changes and hence resulting in another deployment of a solution.
E.g. Consider a case where you have marked your Custom Top Navigation code to have 6 nodes(Hard coded value / taken from constants ); But due to some requirement changes you need to make it 8 nodes now.How you will do it ? Again a Code Change ? If you do; this will require another solution deployment.
Instead of that; identify these kind of parameters in your custom application and try and make those as configurable as possible which may lead to changes in future.
For this to have create a new list Named Configuration Settings at root site collection (of course you can have any name), with 3 site columns :
- Rename Title as Config Key : A key used in solution E.g. NumberOfTopNavigationNodes
- Config Value : Value for a key E.g. 6
- Description : Description of Key and Value or where it is pointing to. E.g. Number of top Navigation nodes used in Top Navigation web part under Controls WSP.
Note: I have used internal Name of Title column in query so rename the column aa.
Lets have a look at the code which will do it for us:
Lets have a look at the code which will do it for us:

Join the conversation! Your thoughts help the community grow.