1. Using updatepanel and using javascript (client side code) are 2 different things so don't mix them
2. If you hide a control (visible false) using updatepanel or postback. Both will make the javascript fail as control is not rendered hence display block will not work
Hence instead of visible false use the following
btn1.Attributes["style"] = "display:none";