why first click on link button doesn't work?

元气小坏坏 提交于 2019-12-12 03:07:21

问题


I have this linkButton:

<asp:LinkButton runat="server" ID="SaveAllItems" class="saveAll"
                OnClientClick="saveToGroups();return false;"  
                OnClick="saveToAll_Click" 
                Text="Save Items"   />

My first click on this button doesnt work and I dont know why. I tried adding return false; to OnClick but nothing has changed.

saveToGroups- works in js
saveToAll_Click - works in cs

What am I missing here?


回答1:


Remove return false from your OnClientClick event, since it will not post your page back and prevent the button click being fired for the first time.




回答2:


You're returning false to OnClientClick -- it prevents the postback.



来源:https://stackoverflow.com/questions/20192209/why-first-click-on-link-button-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!