Customizing software can be hard on your staff and your client’s billable hours.
To remove some of that stress, we code our administrative functions to make it possible for clients to view certain pages of an application where they may want to add/edit/remove input controls.
Table of Contents
Adding Switches With Razor MVC
Using Razor MVC, we were able to add switches to show/hide each field and even change the labeling.
Below is an example of how we add a switch to a field.
We define every field in the application in its own class (QnField).
The Get method will check the properties of that field specific to the configuration set up by the administrator.
The Show() property will display the HTML if true or hide it if false.
The Label() property will perform a switch with the default text in the parameter, which any text the administrator may have assigned.
If a customer wants to add a custom field on the page, the administrator can select the specific page(s), label the field, and assign its input type.
Below is an example of a partial view that checks the field’s input type and then places the correct control on the page.
We use common prefix tags for each control type and then append the custom field ID number to complete the field identification.
We handle the configuration in the database with the table below, along with other reference tables.
In addition to saving the value, we reference the exact parent record for the instance that it was saved on.
Creating dynamic controls does require quite a bit of setup and design, but the control you can give your clients is worth the time spent.
Conclusion
Incorporating customizable, dynamic input controls can significantly enhance client autonomy and flexibility.
Through Razor MVC, administrators gain the power to manage input fields with ease, adapting to various client needs.
While the setup and configuration may be complex, the resulting control and efficiency are invaluable.
By offering these capabilities, you empower clients to make real-time adjustments without additional development time.
Ultimately, dynamic input controls add substantial value to software, benefiting both clients and developers alike.