简体   繁体   中英

postback of button click not working with <%= %>

I am using the below method of calling the click event of buttton in javascript.

__doPostBack('<%= btn_hid.UniqueID %>');

but this is leading me to another error

The Controls collection cannot be modified because the control contains code blocks (ie <% ... %>).

can you please suggest me any other way to call the click event of button in javascript during postback??

您可以尝试使用基于GetElementById方法的click method方法

document.GetElementById('<%= btn_hid.ClientID %>').click()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM