Application background
When you need to activate a function, you need to fill in some form information. After the information is completed and submitted, this part of information cannot be modified again. The form contains TextBox, DropDownList, and CheckBox controls.
Demand implementation
The first solution is to set the Enable attribute of the control to False when binding the data entered by the user. This method can be used if the number of forms on the page is small, but it is not better if the number of forms is large.
Solution 2: Use Foreach to access the page control and set Enable to False if the judgment type is TextBox, DropDownList, or CheckBox. The amount of code is reduced compared with the first solution, but it is still not the best.
The third solution is simple. It can be easily implemented using Jquery.
$ (": Input"). attr ("disabled", "disabled ");
Summary
There are many ways to implement the same function. What we think is how to find the one that is faster and more suitable in a specific scenario.
Source: blog