In terms of maintainability, I would use ViewState. This is less code to write, which reduces the number of errors in your software. It also means that any developers who come after you will have an easier time supporting your decision.
If this is not convenient for you, write the accessor property on the page, which acts as a facade for retrieving the value from the ViewState. Later, if you are forced to convert it to a hidden field, the accessor can easily handle this switch for the rest of the code. Just make sure you document your reasons for this.
Mike hofer
source share