Rather than specifying web user control properties with string type we can have much controlled properties using enums. For example.. I need to create a user control with two command buttons which I should be able to use in few places in a page. Two command buttons should appear horizontally or vertically depending on a property (DrawMode) in the user control.
I have following layout in html
Click to enlarge
Then I can write property as follows in the user control
Click to enlarge
The user of this user control must specify the "Verticle" correctly for this to work. There is no control over the value you can set to the property.
You can enhance this code using an enum as follows
Click to enlarge
The advantage is that you have the total control over the property values that can be assigned.
Click to enlarge
Subscribe to:
Post Comments (Atom)
Popular Posts
-
az aks get-credentials is used to get the kubeconfig updated so that we can access AKS clusters from a terminal (You need to first use az ...
-
In Azure DevOps YAML pipelines there are several functions available for you to use. replace is such a useful function, which you can use t...
-
GitHub Actions are the CI/CD workflow implementation tool built into GitHub repos. While using the GitHub Actions workflows you may want to ...
-
Some times a silly mistake can waste lot of time of a developer. The exception “System.IO.IOException: The response ended prematurely.” whil...
-
Pull Request are the controlled way to bring in the changes to your stable branches in your Azure Git repos, or for that matter all Git prov...
No comments:
Post a Comment