The first argument to the
__doPostBack
function is the ID of the control which is causing the postback. You are passing the string
'btn'
, which is the name of the javascript variable, not the ID of the control.
Change your code to:
var btn = document.getElementById("<%=Button1.ClientID %>");
__doPostBack(btn.id, '');