See this question for your answer.
Setting the DisplayTarget property of the button to the value "Client" will hide the button if used from Enterprise Portal and will enable you to override the clicked
method.
If you not plan to use the list page in EP then go ahead.
Otherwise you will have to put your code in the target form init
or class main
method.