Here I need to call a javascript function first and after some time I need to call a c# function on the same button click event. Is it possible?
<asp:ImageButton ID="imgBTNExportPPT" runat="server" Width="15" Height="15" border="0"
OnClientClick="JavaScript:exportCharts('JPG');" OnClick="imgBTNExportPPT_Click" ImageUrl="~/Images/PPT_icon.png" />
Any suggestion?
If by “after some time” you mean something like “after 3 seconds an action has to be executed” then you can use setTimeout
setTimeout(functionToCallAfterIntervalToWait, intervalToWait)If you want to call a server side method you can use an ajax call inside functionToCallAfterIntervalToWait – leave a comment if you need help with the ajax call
For an example on how to call your asp.net server method from javascript see this blogpost (google call asp .net server method from javascript for more examples/tutorials)
Assuming you are using jQuery you would write (using .ajax()):
If you want that this function call is made after other client side operations make sure to write below (after) the other commands .