Monday, October 10, 2011

asp.net updatepanel : javascript button click refreshes whole page ?

you want to use javascript to click a button in an updatepanel? it seems to update the whole page. solution :

put a linkbutton, set to style="display:none", and the onclick same as the button's onclick

x



(assuming button client ID is BTN1 and linkbutton client ID is LNK1)

instead of document.getElementById('BTN1').click(),

use __doPostBack('LNK1','')

I don't know why u can't do the same __doPostBack thing with button, but it works with LinkButton