calling two functions on asp.net button onclick

前端 未结 3 1110
栀梦
栀梦 2021-01-13 16:53

I want to call two functions on button click I tried like this

 

        
3条回答
  •  臣服心动
    2021-01-13 17:16

    Another option is to use the onclientclick event which allows you to run a JS function w/o a server interaction.

    
        
            
            
        
        
            
        
    
    

    In the first button (adds a new row to the table), I have a server side onclick="btnAdd_Click" as well as a client side OnClientClick="javascript:ResetSaveFlag()".

    The second button (clears a row and sets a "clean" flag so onbeforeunload won't run), I'm not using any server side code, just the client side OnClientClick="javascript:ResetSaveFlag(); javascript:clearEntries(this)". The first one clears the "dirty" flag and the second one clears the row of any entries.

    If anyone's interested I can post the clean & dirty flag JS, but it didn't really seem germane to the original question.

提交回复
热议问题