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
-
Dynamic block allows to create nested multi level block structures in terraform code. Conditional usage of such blocks are really useful in...
-
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...
-
We have discueed, that we have to use an environment variable to handle input parameter default values, if we are using trigger for workflo...
-
Adding Azure Container Registry (ACR) service connection to Azure DevOps is really simple as described in " Create Service Connection ...
-
Some times a silly mistake can waste lot of time of a developer. The exception “System.IO.IOException: The response ended prematurely.” whil...
No comments:
Post a Comment